All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ccsds.moims.mo.common.directory.structures.ProviderDetails Maven / Gradle / Ivy

package org.ccsds.moims.mo.common.directory.structures;

/**
 * The ProviderDetails structure holds information about a provider of a service 
 * and its capabilities. The structure contains a list of AddressDetails structures 
 * which should be used when the individual services listed by the provider 
 * do not supply address information. A provider may support more than one 
 * transport technology and therefore can be reached using more than one address. 
 */
public final class ProviderDetails implements org.ccsds.moims.mo.mal.structures.Composite {

    /**
     * Short form for type.
     */
    @Deprecated
    private static final Integer TYPE_SHORT_FORM = 1;
    /**
     * Absolute short form for type. This will be replaced by the TypeId.
     */
    @Deprecated
    public static final Long SHORT_FORM = 844429241876481L;
    private static final long serialVersionUID = 844429241876481L;
    /**
     * Absolute short form for type.
     */
    public static final org.ccsds.moims.mo.mal.TypeId TYPE_ID = new org.ccsds.moims.mo.mal.TypeId(SHORT_FORM);

    /**
     * The service capabilities supported by this service provider.
     */
    private org.ccsds.moims.mo.common.directory.structures.ServiceCapabilityList serviceCapabilities;

    /**
     * List of addresses for all services of this service provider unless service 
     * specific addresses are supplied in the serviceCapabilities field. If all 
     * address information is supplied in the serviceCapabilities field this list 
     * should be zero length. 
     */
    private org.ccsds.moims.mo.common.directory.structures.AddressDetailsList providerAddresses;

    /**
     * Default constructor for ProviderDetails.
     * 
     */
    public ProviderDetails() {
    }

    /**
     * Constructor that initialises the values of the structure.
     * 
     * @param serviceCapabilities The service capabilities supported by this service 
     * provider. 
     * @param providerAddresses List of addresses for all services of this service 
     * provider unless service specific addresses are supplied in the serviceCapabilities 
     * field. If all address information is supplied in the serviceCapabilities 
     * field this list should be zero length. 
     */
    public ProviderDetails(org.ccsds.moims.mo.common.directory.structures.ServiceCapabilityList serviceCapabilities,
            org.ccsds.moims.mo.common.directory.structures.AddressDetailsList providerAddresses) {
        this.serviceCapabilities = serviceCapabilities;
        this.providerAddresses = providerAddresses;
    }

    /**
     * Creates an instance of this type using the default constructor. It is a 
     * generic factory method. 
     * 
     * @return A new instance of this type with default field values.
     */
    public org.ccsds.moims.mo.mal.structures.Element createElement() {
        return new org.ccsds.moims.mo.common.directory.structures.ProviderDetails();
    }

    /**
     * Returns the field serviceCapabilities.
     * 
     * @return The field serviceCapabilities.
     */
    public org.ccsds.moims.mo.common.directory.structures.ServiceCapabilityList getServiceCapabilities() {
        return serviceCapabilities;
    }

    /**
     * Sets the field serviceCapabilities.
     * 
     * @param __newValue The new value.
     */
    @Deprecated
    public void setServiceCapabilities(org.ccsds.moims.mo.common.directory.structures.ServiceCapabilityList __newValue) {
        serviceCapabilities = __newValue;
    }

    /**
     * Returns the field providerAddresses.
     * 
     * @return The field providerAddresses.
     */
    public org.ccsds.moims.mo.common.directory.structures.AddressDetailsList getProviderAddresses() {
        return providerAddresses;
    }

    /**
     * Sets the field providerAddresses.
     * 
     * @param __newValue The new value.
     */
    @Deprecated
    public void setProviderAddresses(org.ccsds.moims.mo.common.directory.structures.AddressDetailsList __newValue) {
        providerAddresses = __newValue;
    }

    /**
     * Compares this object to the specified object. The result is true if and 
     * only if the argument is not null and is the same type that contains the 
     * same value as this object. 
     * 
     * @param obj The object to compare with.
     * @return true if the objects are the same; false otherwise.
     */
    public boolean equals(Object obj) {
        if (obj instanceof ProviderDetails) {
            ProviderDetails other = (ProviderDetails) obj;
            if (serviceCapabilities == null) {
                if (other.serviceCapabilities != null) {
                    return false;
                }
            } else {
                if (! serviceCapabilities.equals(other.serviceCapabilities)) {
                    return false;
                }
            }
            if (providerAddresses == null) {
                if (other.providerAddresses != null) {
                    return false;
                }
            } else {
                if (! providerAddresses.equals(other.providerAddresses)) {
                    return false;
                }
            }
            return true;
        }
        return false;
    }

    /**
     * Returns a hash code for this object.
     * 
     * @return a hash code value for this object.
     */
    public int hashCode() {
        int hash = 7;
        hash = 83 * hash + (serviceCapabilities != null ? serviceCapabilities.hashCode() : 0);
        hash = 83 * hash + (providerAddresses != null ? providerAddresses.hashCode() : 0);
        return hash;
    }

    /**
     * Returns a String object representing this type"s value.
     * 
     * @return a string representation of the value of this object.
     */
    public String toString() {
        StringBuilder buf = new StringBuilder();
        buf.append("(ProviderDetails: ");
        buf.append("serviceCapabilities=");
        buf.append(serviceCapabilities);
        buf.append(", providerAddresses=");
        buf.append(providerAddresses);
        buf.append(')');
        return buf.toString();
    }

    /**
     * Encodes the value of this object using the provided MALEncoder.
     * 
     * @param encoder The encoder to use for encoding.
     * @throws org.ccsds.moims.mo.mal.MALException if any encoding errors are 
     * detected. 
     */
    public void encode(org.ccsds.moims.mo.mal.MALEncoder encoder) throws org.ccsds.moims.mo.mal.MALException {
        if (serviceCapabilities == null) {
            throw new org.ccsds.moims.mo.mal.MALException("The field 'serviceCapabilities' cannot be null!");
        }
        if (providerAddresses == null) {
            throw new org.ccsds.moims.mo.mal.MALException("The field 'providerAddresses' cannot be null!");
        }
        encoder.encodeElement(serviceCapabilities);
        encoder.encodeElement(providerAddresses);
    }

    /**
     * Decodes the value of this object using the provided MALDecoder.
     * 
     * @param decoder The decoder to use for decoding.
     * @return Returns this object.
     * @throws org.ccsds.moims.mo.mal.MALException if any decoding errors are 
     * detected. 
     */
    public org.ccsds.moims.mo.mal.structures.Element decode(org.ccsds.moims.mo.mal.MALDecoder decoder) throws org.ccsds.moims.mo.mal.MALException {
        serviceCapabilities = (org.ccsds.moims.mo.common.directory.structures.ServiceCapabilityList) decoder.decodeElement(new org.ccsds.moims.mo.common.directory.structures.ServiceCapabilityList());
        providerAddresses = (org.ccsds.moims.mo.common.directory.structures.AddressDetailsList) decoder.decodeElement(new org.ccsds.moims.mo.common.directory.structures.AddressDetailsList());
        return this;
    }

    /**
     * Returns the absolute short form of this type.
     * 
     * @return The absolute short form of this type.
     */
    public Long getShortForm() {
        return SHORT_FORM;
    }

    /**
     * Returns the type short form of this type which is unique to the area/service 
     * it is defined in but not unique across all types. 
     * 
     * @return The type short form of this type.
     */
    public Integer getTypeShortForm() {
        return TYPE_SHORT_FORM;
    }

    /**
     * Returns the area number of this type.
     * 
     * @return The area number of this type.
     */
    public org.ccsds.moims.mo.mal.structures.UShort getAreaNumber() {
        return org.ccsds.moims.mo.common.CommonHelper.COMMON_AREA_NUMBER;
    }

    /**
     * Returns the area version of this type.
     * 
     * @return The area number of this type.
     */
    public org.ccsds.moims.mo.mal.structures.UOctet getAreaVersion() {
        return org.ccsds.moims.mo.common.CommonHelper.COMMON_AREA_VERSION;
    }

    /**
     * Returns the service number of this type.
     * 
     * @return The service number of this type.
     */
    public org.ccsds.moims.mo.mal.structures.UShort getServiceNumber() {
        return org.ccsds.moims.mo.common.directory.DirectoryServiceInfo.DIRECTORY_SERVICE_NUMBER;
    }

    /**
     * Returns the TypeId of this element.
     * 
     * @return The TypeId of this element.
     */
    public org.ccsds.moims.mo.mal.TypeId getTypeId() {
        return TYPE_ID;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy