Interface TypeAttributeDescriptor

  • All Known Implementing Classes:
    DefaultTypeAttributeDescriptor

    public interface TypeAttributeDescriptor
    Describes an item type attribute from the integration object item point of view. Provides metadata necessary for conversion of the payloads to/from the ItemModel.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getAttributeName()
      Gets name of the attribute described by this descriptor.
      TypeDescriptor getAttributeType()
      Retrieves type of this attribute value(s).
      java.lang.String getQualifier()
      Gets name of this attribute in the platform type system.
      TypeDescriptor getTypeDescriptor()
      Retrieves descriptor of the type, this attribute is associated with.
      boolean isAutoCreate()
      Determines whether the item referenced by this attribute should be persisted when the item with this attribute is persisted.
      boolean isCollection()
      Determines whether this attribute contains a single value or multiple values (a collection of values).
      boolean isLocalized()
      Determines whether the value of this descriptor can be localized.
      boolean isMap()
      Determines whether the attribute is referring to a map of values.
      boolean isNullable()
      Determines whether the attribute represented by this descriptor can take null values.
      boolean isPartOf()
      Determines whether the item referenced by this attribute should be a part of the attribute's item model or not.
      boolean isPrimitive()
      Determines whether the value of this descriptor is a primitive type
      java.util.Optional<TypeAttributeDescriptor> reverse()
      Reverses the relation described by this attribute descriptor and retrieves an attribute descriptor defined in the getAttributeType() type descriptor with getTypeDescriptor() attribute type.
    • Method Detail

      • getAttributeName

        java.lang.String getAttributeName()
        Gets name of the attribute described by this descriptor.
        Returns:
        name of the attribute as it was defined for the integration object.
      • getQualifier

        java.lang.String getQualifier()
        Gets name of this attribute in the platform type system.
        Returns:
        name of this attribute in the type system.
      • isCollection

        boolean isCollection()
        Determines whether this attribute contains a single value or multiple values (a collection of values).
        Returns:
        true, if this attribute contains a collection of primitive or complex type values; false, if this attribute contains only a single primitive or complex type value.
      • getAttributeType

        TypeDescriptor getAttributeType()
        Retrieves type of this attribute value(s).
        Returns:
        type of this attribute value, which may be a primitive type or a complex type referring an item in the type system; or a type of the referenced element(s) in case, if this attributes contains a collection of values or represents a one-to-one, one-to-many or many-to-many relationship.
        See Also:
        isCollection()
      • getTypeDescriptor

        TypeDescriptor getTypeDescriptor()
        Retrieves descriptor of the type, this attribute is associated with.
        Returns:
        descriptor of the item type that contains the attribute described by this attribute descriptor.
      • reverse

        java.util.Optional<TypeAttributeDescriptor> reverse()

        Reverses the relation described by this attribute descriptor and retrieves an attribute descriptor defined in the getAttributeType() type descriptor with getTypeDescriptor() attribute type.

        For example, type Parent has attribute children that refers a collection of type Child; and type Child has an attribute parent referring back to Parent type. Then attribute descriptor for parent attribute is reverse for children attribute descriptor.

        Another example, type Organization has attribute addresses that refers a collection of type Address; but type Address does not refer back to type Organization. In this case there is no reverse attribute for addresses attribute descriptor.

        Returns:
        an optional containing a descriptor for the attribute in type returned by getAttributeType(), which refers back to the type retrieved by calling getTypeDescriptor() on this attribute descriptor; or an empty optional that attribute type of this descriptor does not refer back to the type containing this attribute descriptor.
      • isNullable

        boolean isNullable()
        Determines whether the attribute represented by this descriptor can take null values.
        Returns:
        true, if the attribute can take null values; false, if the attribute value is required.
      • isPartOf

        boolean isPartOf()
        Determines whether the item referenced by this attribute should be a part of the attribute's item model or not. This defines in particular whether the nested referenced item will be created whenever the "container" item is persisted (part of) or it can and should exist and persist independently (not a part of). For example, a Car has an attribute engine, which refers item Engine. If the business model is interested in cars only and does not care about engines outside of the car model, then the attribute should be defined with partOf == true. If the engine has independent existence, e.g. engine can be sold without a car, then the attribute should defined with partOf == false.

        In other words, this attribute descriptor defines a relation between an owner and the owned item. Thus in the example above Engine is owned by Car as it does not have independent existence in the model.

        Returns:
        true, if the item referenced by this attribute descriptor is an integral part of its owner model.
        See Also:
        isAutoCreate()
      • isAutoCreate

        boolean isAutoCreate()
        Determines whether the item referenced by this attribute should be persisted when the item with this attribute is persisted. Unlike isPartOf() this method does not require the referenced item to be an integral part of the owner item. The referenced item may have its independent existence in the domain model and yet it will be persisted together with the item holding an attribute described by this descriptor.
        Returns:
        true, if the attribute's item should be included within the item holding an attribute described by this descriptor; false, if the referenced item should not be persisted with the item holding an attribute described by this descriptor.
        See Also:
        isPartOf()
      • isLocalized

        boolean isLocalized()
        Determines whether the value of this descriptor can be localized. This method may need to be used with isMap() to determine whether the attribute supports multiple locale specific values. Some attributes may be localized but do not support multi-locale values. For example, a simple Numeric or Boolean attribute can be declared as localized.
        Returns:
        true if localized, else false
      • isPrimitive

        boolean isPrimitive()
        Determines whether the value of this descriptor is a primitive type
        Returns:
        true if it's a primitive type, else false
      • isMap

        boolean isMap()
        Determines whether the attribute is referring to a map of values. Typically used to determiine in conjunction with isLocalized() to determine whether the attribute can hold multiple locale specific values. However, it can be used by itself.
        Returns:
        true, if the attribute refers to a map; false otherwise.