Class ItemTypeDescriptor

java.lang.Object
de.hybris.platform.integrationservices.model.impl.AbstractDescriptor
de.hybris.platform.integrationservices.model.impl.ItemTypeDescriptor
All Implemented Interfaces:
TypeDescriptor

public class ItemTypeDescriptor extends AbstractDescriptor implements TypeDescriptor
Common superclass for all descriptors produced by DefaultDescriptorFactory

This implementation is effectively immutable and therefore is thread safe

Reuse this implementation through composition not inheritance

  • Method Details

    • getIntegrationObjectCode

      public String getIntegrationObjectCode()
      Description copied from interface: TypeDescriptor
      Reads value of the integration object code.
      Specified by:
      getIntegrationObjectCode in interface TypeDescriptor
      Returns:
      integration object code this item belongs to.
    • getItemCode

      public String getItemCode()
      Description copied from interface: TypeDescriptor
      Reads value of the integration object item code.
      Specified by:
      getItemCode in interface TypeDescriptor
      Returns:
      integration object item type code. Keep in mind this value may be different from the type code of the item the integration object item represents. For example, type code of the item in the platform may be "Product" but integration object item type could be called "IntegrationProduct".
      See Also:
    • getTypeCode

      public String getTypeCode()
      Description copied from interface: TypeDescriptor
      Reads code (name) of the integration object item type in the type system.
      Specified by:
      getTypeCode in interface TypeDescriptor
      Returns:
      type code of the item in the type system. Keep in mind this value may be different from the integration objec item code. For example, type code of the item in the type system may be "Product" but integration object item code may be different, e.g "IntegrationProduct".
      See Also:
    • getAttribute

      public Optional<TypeAttributeDescriptor> getAttribute(String attrName)
      Description copied from interface: TypeDescriptor
      Retrieves descriptor of the specified attribute.
      Specified by:
      getAttribute in interface TypeDescriptor
      Parameters:
      attrName - name of the integration object item attribute to be retrieved. Keep in mind that name of the attribute in an integration object item may be different from the name of the corresponding attribute in the type system.
      Returns:
      attribute descriptor for the given name or Optional.empty(), if the item type does not have an attribute with such name.
    • getAttributes

      public Collection<TypeAttributeDescriptor> getAttributes()
      Description copied from interface: TypeDescriptor
      Retrieves all attributes defined in an integration object item.
      Specified by:
      getAttributes in interface TypeDescriptor
      Returns:
      a collection of all attributes in the integration object item or an empty collection, if this description is for a primitive type or the item does not have attributes.
    • isPrimitive

      public boolean isPrimitive()
      Description copied from interface: TypeDescriptor
      Determines whether this descriptor is for type representing integration object item or for a primitive type.
      Specified by:
      isPrimitive in interface TypeDescriptor
      Returns:
      true, if this descriptor is for a primitive type, e.g. Integer, String, etc; false, otherwise.
    • isEnumeration

      public boolean isEnumeration()
      Description copied from interface: TypeDescriptor
      Determines whether this descriptor is for a type representing type system enumeration.
      Specified by:
      isEnumeration in interface TypeDescriptor
      Returns:
      true, if this descriptor is for an enumeration type; false otherwise.
    • isAbstract

      public boolean isAbstract()
      Description copied from interface: TypeDescriptor
      Determines whether this descriptor is an abstract item type
      Specified by:
      isAbstract in interface TypeDescriptor
      Returns:
      true, if the item type of this descriptor has abstract == true
    • isInstance

      public boolean isInstance(Object obj)
      Description copied from interface: TypeDescriptor
      Determines whether the specified object is an instance of the type presented by this type descriptor.
      Specified by:
      isInstance in interface TypeDescriptor
      Parameters:
      obj - an object to evaluate.
      Returns:
      true, if the specified object is an instance of the type presented by this type descriptor; false, if the object is null or cannot be described by this type descriptor.
    • isRoot

      public boolean isRoot()
      Description copied from interface: TypeDescriptor
      Determines whether this descriptor is for the root item in the Integration Object
      Specified by:
      isRoot in interface TypeDescriptor
      Returns:
      true, if this descriptor is the root; false otherwise.
    • getKeyDescriptor

      public KeyDescriptor getKeyDescriptor()
      Description copied from interface: TypeDescriptor
      Retrieves key descriptor of this item type.
      Specified by:
      getKeyDescriptor in interface TypeDescriptor
      Returns:
      descriptor of the key identifying instances of this item type.
    • getPathsToRoot

      public List<ReferencePath> getPathsToRoot()
      Description copied from interface: TypeDescriptor
      Retrieves attribute path from this item type to the root item type in the same integration object.
      Specified by:
      getPathsToRoot in interface TypeDescriptor
      Returns:
      a list of all possible paths in order from the shorter ones to the longer paths. If this type descriptor does not contain attribute(s) that eventually lead to the root item type, then an empty list is returned.
      See Also:
    • hasPathToRoot

      public boolean hasPathToRoot()
      Description copied from interface: TypeDescriptor
      Determines whether it's possible to navigate from an integration item described by this type descriptor to the root item of the integration object.
      Specified by:
      hasPathToRoot in interface TypeDescriptor
      Returns:
      true, if this type descriptor describes a root item type in the integration object or it has a ReferencePath to the root item type.
      See Also:
    • pathFrom

      public List<ReferencePath> pathFrom(TypeDescriptor itemType)
      Description copied from interface: TypeDescriptor
      Retrieves attribute path from the specified item type to this item type. For example, if there is an integration object:
           Product
           - catalogVersion -> CatalogVersion
                               - catalog -> Catalog
                                            - id
           - categories -> Category
                           - catalogVersion -> CatalogVersion
                                               - catalog -> Catalog
                                                            - id
       
      where Product, Category, CatalogVersion and Catalog are integration object items and catalogVersion, categories, catalog and id are the attributes in the corresponding items. If current type descriptor is for Catalog type and the Product type descriptor is passed, then the paths are: Product.catalogVersion.catalog and Product.categories.catalogVersion.catalog.
      Specified by:
      pathFrom in interface TypeDescriptor
      Parameters:
      itemType - descriptor of the item type, from which the path has to be calculated.
      Returns:
      all paths from the specified type to the type described this descriptor in order from the shortest to the longest path or an empty list, if this type descriptor and the specified item type are not related, ie. there is no a single path.
    • setReferencePathFinder

      public void setReferencePathFinder(ReferencePathFinder finder)
      Injects ReferencePathFinder implementation to use.
      Parameters:
      finder - a finder implementation to use for methods returning ReferencePaths. null value resets the finder implementation to default, which is AttributePathFinder
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object