Class PropertyDescriptionModel

java.lang.Object
com.highdeal.pnr.hci.PropertyDescriptionModel
All Implemented Interfaces:
XMLMarshallable

public class PropertyDescriptionModel extends Object implements XMLMarshallable
This class represents the description of a property as seen by a client application. Each property description specifies a type, a name and a description for the property.

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="prop">
   <xs:complexType>
     <xs:sequence>
       <xs:element ref="additionalInformation" minOccurs="0" maxOccurs="unbounded"/>
     </xs:sequence>
     <xs:attribute name="name" type="xs:string" use="required"/>
     <xs:attribute name="type" type="PropertyDescType" default="string"/>
     <xs:attribute name="description" type="xs:string"/>
   </xs:complexType>
 </xs:element>

 <xs:simpleType name="PropertyDescType">
   <xs:restriction base="xs:string">
      <xs:enumeration value="number"/>
      <xs:enumeration value="string"/>
      <xs:enumeration value="date"/>
   </xs:restriction>
 </xs:simpleType>

  • Constructor Details

    • PropertyDescriptionModel

      public PropertyDescriptionModel()
      Builds an empty PropertyDescriptionModel.
    • PropertyDescriptionModel

      public PropertyDescriptionModel(String name, String description, int type)
      Builds a PropertyDescriptionModel.
      Parameters:
      name - the name of the property
      description - a textual description for the property
      type - the type of the property (see setType(int) for allowed values)
  • Method Details

    • getName

      public String getName()
      Returns the name of the property.
      Returns:
      the property name.
    • setName

      public void setName(String name)
      Sets the name of the property.
      Parameters:
      name - the name of the property
    • getDescription

      public String getDescription()
      Returns the textual description of the property.
      Returns:
      the description of the property.
    • setDescription

      public void setDescription(String description)
      Sets the textual description for the property.
      Parameters:
      description - the associated textual description.
    • getType

      public int getType()
      Returns the property type of the property description. The returned types are:
      Returns:
      the property type.
    • setType

      public void setType(int t)
      Sets the property description type. The allowed types are:
      Parameters:
      t - the property type.
    • getAdditionalInfos

      public List<AdditionalInfoModel> getAdditionalInfos()
      Returns the additional info list.
      Returns:
      the additional info list.
    • getAdditionalInfo

      public AdditionalInfoModel getAdditionalInfo(String name)
      Returns an additional info depending on its name.
      Parameters:
      name - The additional info name.
      Returns:
      The additional info or null if not found.
    • getAdditionalInfo

      public <T> T getAdditionalInfo(String name, Class<T> clazz, T defaultValue)
      Returns an additional info value depending on its name and type.
      Parameters:
      name - The additional info name.
      clazz - The additional info type.
      defaultValue - The default value if there is no matching additional info.
      Returns:
      the additional info value or the default value if not found.
    • duplicate

      public PropertyDescriptionModel duplicate()
      Duplicates the property.
      Returns:
      a clone of the property.
    • checkValidity

      public boolean checkValidity()
      Returns true if the property is valid. Property is valid if its name is not null or empty.
      Returns:
      true if the property is valid, false otherwise.
    • validatePropertyDescriptionModel

      public static boolean validatePropertyDescriptionModel(PropertyDescriptionModel pdm)
    • validatePropertyDescriptionModelType

      public static boolean validatePropertyDescriptionModelType(PropertyDescriptionModel pdm)
    • setAttributes

      public void setAttributes(XMLAttributes atts)
      Description copied from interface: XMLMarshallable
      Sets the attributes of the XML representation of the element being processed.
      Specified by:
      setAttributes in interface XMLMarshallable
      Parameters:
      atts - The XML attributes of the current element
    • addChild

      public void addChild(String name, XMLMarshallable child)
      Description copied from interface: XMLMarshallable
      Adds a child to the object, the child representing the marshallable object which must be added to the element.
      Specified by:
      addChild in interface XMLMarshallable
      Parameters:
      name - The name of tag for the child
      child - The child to be added
    • addCharacterData

      public void addCharacterData(String cData)
      Description copied from interface: XMLMarshallable
      Adds character data to the content element.
      Specified by:
      addCharacterData in interface XMLMarshallable
      Parameters:
      cData - The character data to be added
    • marshal

      public void marshal(XMLOutputter output)
      Description copied from interface: XMLMarshallable
      Gives an XML representation of this object, including its children.
      Specified by:
      marshal in interface XMLMarshallable
      Parameters:
      output - The XML output to marshal the object into