Class ProductCmptType


public class ProductCmptType extends Type
Corresponds to a design time IProductCmptType.
  • Field Details

    • KIND_NAME

      public static final String KIND_NAME
      The name of the design time implementation class. Don't ask about the 2.
      See Also:
  • Constructor Details

  • Method Details

    • getKindName

      protected String getKindName()
      Specified by:
      getKindName in class Type
    • getDeclaredMethods

      protected List<Method> getDeclaredMethods()
      Overrides:
      getDeclaredMethods in class Type
    • isChangingOverTime

      public boolean isChangingOverTime()
      Returns whether this product component type is changing over time.
      Returns:
      true if it has generations else false
    • isConfigurationForPolicyCmptType

      public boolean isConfigurationForPolicyCmptType()
      Returns whether this product component type is a configuration for a policy component type.
      Returns:
      true if this type configures a policy component type, false if not
    • isSameOrSub

      public boolean isSameOrSub(ProductCmptType reference)
      Returns whether this ProductCmptType is the same or sub-type compared to a reference ProductCmptType.
      Parameters:
      reference - the ProductCmptType to compare to
      Returns:
      true if this type is the same or sub-type of the reference.
    • getPolicyCmptType

      public PolicyCmptType getPolicyCmptType()
      Returns the policy component type which is configured by this product component type. If this product component class has no configuration it throws a NullPointerException.
      Returns:
      The configured policy component type
      Throws:
      NullPointerException - if the product component type is not a configuration for a policy component type
      See Also:
    • getTableUsage

      public TableUsage getTableUsage(String name)
      Returns the TableUsage for the specified name. May look in super types if there is no table usage in this type.
      Parameters:
      name - The name of the table usage
      Returns:
      The TableUsage with the specified name
      Throws:
      IllegalArgumentException - if there is no table usage with the specified name
    • getDeclaredTableUsages

      public List<TableUsage> getDeclaredTableUsages()
      Returns a list of TableUsages which are declared in this type. In contrast to getTableUsages() this does not return table usages of super types.
      Returns:
      A list of TableUsages declared in this type
    • getDeclaredTableUsage

      public TableUsage getDeclaredTableUsage(String name)
      Returns the TableUsage with the given name which is declared in this type. Any table usage defined in the super types will not be returned.
      Parameters:
      name - The name of the TableUsage
      Returns:
      TableUsage declared in this type with the given name
      Throws:
      IllegalArgumentException - if this type does not have a declared table usage with the given name
    • hasDeclaredTableUsage

      public boolean hasDeclaredTableUsage(String name)
      Returns whether the TableUsage for the specified name is declared in this type.
    • getDeclaredFormulas

      public List<Formula> getDeclaredFormulas()
      Returns a list of Formulas which are declared in this type. In contrast to getFormulas() this does not return formulas of super types.
      Returns:
      A list of Formulas declared in this type
      Since:
      24.7
    • getDeclaredFormula

      public Formula getDeclaredFormula(String name)
      Returns the Formula with the given name which is declared in this type. Any formula defined in the super types will not be returned.
      Parameters:
      name - The name of the Formula
      Returns:
      Formula declared in this type with the given name
      Throws:
      IllegalArgumentException - if this type does not have a declared formula with the given name
      Since:
      24.7
    • hasDeclaredFormula

      public boolean hasDeclaredFormula(String name)
      Returns whether the Formula for the specified name is declared in this type.
    • getTableUsages

      public List<TableUsage> getTableUsages()
      Returns a list of TableUsages which are declared in this type or in any super type.
      Returns:
      All TableUsages accessible in this product type.
    • getGenerationJavaClass

      public Class<?> getGenerationJavaClass()
    • getGenerationJavaInterface

      public Class<?> getGenerationJavaInterface()
    • getGenerationDeclarationClass

      public Class<?> getGenerationDeclarationClass()
    • getSuperType

      public ProductCmptType getSuperType()
      Description copied from class: Type
      Returns this type's super type or null if it has none.
      Specified by:
      getSuperType in class Type
      See Also:
    • findSuperType

      public Optional<ProductCmptType> findSuperType()
      Description copied from class: Type
      Returns this type's super type if present, otherwise an empty Optional.
      Overrides:
      findSuperType in class Type
    • getDeclaredAttribute

      public ProductAttribute getDeclaredAttribute(int index)
      Description copied from class: Type
      Returns the declared attribute at the given index.
      Overrides:
      getDeclaredAttribute in class Type
    • getDeclaredAttribute

      public ProductAttribute getDeclaredAttribute(String name)
      Description copied from class: Type
      Returns the attribute with the given name declared in this type. Attributes defined in the type's super types are not returned.
      Specified by:
      getDeclaredAttribute in class Type
      Parameters:
      name - the name of the attribute
      Returns:
      the attribute if it was found in this type
      See Also:
    • getDeclaredAttributes

      public List<ProductAttribute> getDeclaredAttributes()
      Description copied from class: Type
      Returns a list containing all attributes declared in this model type. Attributes defined in the type's super types are not returned.
      Specified by:
      getDeclaredAttributes in class Type
      Returns:
      the list of attributes declared in this type
    • getAttribute

      public ProductAttribute getAttribute(String name)
      Description copied from class: Type
      Returns the attribute with the given name declared in this type or one of it's super types.
      Overrides:
      getAttribute in class Type
    • getAttributes

      public List<ProductAttribute> getAttributes()
      Description copied from class: Type
      Returns a list containing the type's attributes including those defined in the type's super types.
      Specified by:
      getAttributes in class Type
      Returns:
      the list of all attributes declared in this type or in any supertype
    • getFormula

      public Formula getFormula(String name)
      Returns the Formula for the specified name. May look in super types if there is no formula in this type.
      Parameters:
      name - The name of the formula
      Returns:
      The Formula with the specified name
      Throws:
      IllegalArgumentException - if there is no table usage with the specified name
      Since:
      24.7
    • getFormulas

      public List<Formula> getFormulas()
      Returns:
      all formulas defined on this type.
      Since:
      24.7
    • isAttributeDeclared

      public boolean isAttributeDeclared(String name)
      Description copied from class: Type
      Returns whether the attribute with the given name is declared in this type. Attributes defined in the type's super types are not considered.
      Specified by:
      isAttributeDeclared in class Type
      Parameters:
      name - the name of the attribute
      Returns:
      true if the attribute is declared in this type, false if not
    • getDeclaredAssociation

      public ProductAssociation getDeclaredAssociation(int index)
      Description copied from class: Type
      Returns the association at the given index. Associations defined in the type's super types are not returned.
      Overrides:
      getDeclaredAssociation in class Type
    • getDeclaredAssociation

      public ProductAssociation getDeclaredAssociation(String name)
      Description copied from class: Type
      Returns the association with the given name declared in this type. Associations defined in the type's super types are not considered. The name could either be the singular or the plural name.
      Specified by:
      getDeclaredAssociation in class Type
      Parameters:
      name - the name of the association
      Returns:
      the association if it was found in this type
      See Also:
    • getDeclaredAssociations

      public List<ProductAssociation> getDeclaredAssociations()
      Description copied from class: Type
      Returns a list containing all associations declared in this type. Associations defined in the type's super types are not returned.
      Specified by:
      getDeclaredAssociations in class Type
      Returns:
      the list of associations declared in this type
    • isAssociationDeclared

      public boolean isAssociationDeclared(String name)
      Description copied from class: Type
      Returns whether the association with the given name is declared in this type. Associations defined in the type's super types are not considered.
      Specified by:
      isAssociationDeclared in class Type
      Parameters:
      name - the name of the association
      Returns:
      true if the association is declared in this type, false if not
      See Also:
    • getAssociation

      public ProductAssociation getAssociation(String name)
      Description copied from class: Type
      Returns the association with the given name declared in this type or one of it's super types. The name could either be the singular or the plural name.
      Overrides:
      getAssociation in class Type
    • getAssociations

      public List<ProductAssociation> getAssociations()
      Description copied from class: Type
      Returns the type's associations including those defined in it's super types.
      Specified by:
      getAssociations in class Type
      Returns:
      the list of all associations declared in this type or in any super type
    • findDeclaredFieldFromGeneration

      public <T extends Annotation> Optional<Field> findDeclaredFieldFromGeneration(Class<T> annotationClass, Type.AnnotatedElementMatcher<T> matcher)
    • findDeclaredField

      public <T extends Annotation> Optional<Field> findDeclaredField(Class<T> annotationClass, Type.AnnotatedElementMatcher<T> matcher)
      Description copied from class: Type
      Searches for a field with the given annotation that matches the condition defined by a matcher. Only fields in this type's declaration class are considered, thus no fields from super classes are found.
      Overrides:
      findDeclaredField in class Type
      Parameters:
      annotationClass - the class of the annotation the field must be annotated with
      matcher - matcher to determine if the annotation has the correct properties
      Returns:
      the first field that is both annotated with the given annotation and has the correct annotated properties. Optional.empty() if no such field can be found.
    • validate

      public void validate(IProductComponent productComponent, MessageList messages, IValidationContext context)
      Validates the given product component against this type, provided it matches.
      Parameters:
      productComponent - the enum value instances to validate
      messages - a MessageList, to which validation messages may be added
      context - the IValidationContext, needed to determine the Locale in which to create Messages
      Throws:
      IllegalArgumentException - if the given product component does not match this type
      Since:
      25.1