Package org.faktorips.runtime.model.type
Class ProductCmptType
java.lang.Object
org.faktorips.runtime.model.type.ModelElement
org.faktorips.runtime.model.type.Type
org.faktorips.runtime.model.type.ProductCmptType
Corresponds to a design time
IProductCmptType.-
Nested Class Summary
Nested classes/interfaces inherited from class org.faktorips.runtime.model.type.Type
Type.AnnotatedElementMatcher<T extends Annotation> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Annotation>
Optional<Field>findDeclaredField(Class<T> annotationClass, Type.AnnotatedElementMatcher<T> matcher) Searches for a field with the given annotation that matches the condition defined by amatcher.<T extends Annotation>
Optional<Field>findDeclaredFieldFromGeneration(Class<T> annotationClass, Type.AnnotatedElementMatcher<T> matcher) Returns this type's super type ifpresent, otherwise anempty Optional.getAssociation(String name) Returns the association with the givennamedeclared in this type or one of it's super types.Returns the type's associations including those defined in it's super types.getAttribute(String name) Returns the attribute with the givennamedeclared in this type or one of it's super types.Returns a list containing the type's attributes including those defined in the type's super types.getDeclaredAssociation(int index) Returns the association at the givenindex.getDeclaredAssociation(String name) Returns the association with the givennamedeclared in this type.Returns a list containing all associations declared in this type.getDeclaredAttribute(int index) Returns the declared attribute at the givenindex.getDeclaredAttribute(String name) Returns the attribute with the givennamedeclared in this type.Returns a list containing all attributes declared in this model type.getDeclaredFormula(String name) Returns theFormulawith the givennamewhich is declared in this type.Returns a list ofFormulaswhich are declared in this type.getDeclaredTableUsage(String name) Returns theTableUsagewith the givennamewhich is declared in this type.Returns a list ofTableUsageswhich are declared in this type.getFormula(String name) Returns theFormulafor the specified name.Class<?>Class<?>Class<?>protected StringReturns the policy component type which is configured by this product component type.Returns this type's super type ornullif it has none.getTableUsage(String name) Returns theTableUsagefor the specified name.Returns a list ofTableUsageswhich are declared in this type or in any super type.booleanhasDeclaredFormula(String name) Returns whether theFormulafor the specifiednameis declared in this type.booleanhasDeclaredTableUsage(String name) Returns whether theTableUsagefor the specifiednameis declared in this type.booleanisAssociationDeclared(String name) Returns whether the association with the givennameis declared in this type.booleanisAttributeDeclared(String name) Returns whether the attribute with the givennameis declared in this type.booleanReturns whether this product component type is changing over time.booleanReturns whether this product component type is a configuration for a policy component type.booleanisSameOrSub(ProductCmptType reference) Returns whether thisProductCmptTypeis the same or sub-type compared to a referenceProductCmptType.voidvalidate(IProductComponent productComponent, MessageList messages, IValidationContext context) Validates the given product component against this type, provided it matches.Methods inherited from class org.faktorips.runtime.model.type.Type
findDeclaredMethod, findJavaInterface, getAnnotatedDeclaration, getDeclarationClass, getDeclaredFields, getDocumentation, getJavaClass, getJavaInterface, getMessageHelper, getMessageKey, isAssociationPresent, isAttributePresent, isSuperTypePresent, searchDeclaredMethod, toStringMethods inherited from class org.faktorips.runtime.model.type.ModelElement
createMessageHelper, getDeprecation, getDescription, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRelevantProductObject, getRelevantProductObject, invokeField, invokeMethod, isDeprecated
-
Field Details
-
KIND_NAME
The name of the design time implementation class. Don't ask about the 2.- See Also:
-
-
Constructor Details
-
ProductCmptType
-
-
Method Details
-
getKindName
- Specified by:
getKindNamein classType
-
getDeclaredMethods
- Overrides:
getDeclaredMethodsin classType
-
isChangingOverTime
public boolean isChangingOverTime()Returns whether this product component type is changing over time.- Returns:
trueif it has generations elsefalse
-
isConfigurationForPolicyCmptType
public boolean isConfigurationForPolicyCmptType()Returns whether this product component type is a configuration for a policy component type.- Returns:
trueif this type configures a policy component type,falseif not
-
isSameOrSub
Returns whether thisProductCmptTypeis the same or sub-type compared to a referenceProductCmptType.- Parameters:
reference- theProductCmptTypeto compare to- Returns:
trueif this type is the same or sub-type of the reference.
-
getPolicyCmptType
Returns the policy component type which is configured by this product component type. If this product component class has no configuration it throws aNullPointerException.- 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
Returns theTableUsagefor 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
TableUsagewith the specified name - Throws:
IllegalArgumentException- if there is no table usage with the specified name
-
getDeclaredTableUsages
Returns a list ofTableUsageswhich are declared in this type. In contrast togetTableUsages()this does not return table usages of super types.- Returns:
- A list of
TableUsagesdeclared in this type
-
getDeclaredTableUsage
Returns theTableUsagewith the givennamewhich is declared in this type. Any table usage defined in the super types will not be returned.- Parameters:
name- The name of theTableUsage- Returns:
TableUsagedeclared in this type with the given name- Throws:
IllegalArgumentException- if this type does not have a declared table usage with the given name
-
hasDeclaredTableUsage
Returns whether theTableUsagefor the specifiednameis declared in this type. -
getDeclaredFormulas
Returns a list ofFormulaswhich are declared in this type. In contrast togetFormulas()this does not return formulas of super types.- Returns:
- A list of
Formulasdeclared in this type - Since:
- 24.7
-
getDeclaredFormula
Returns theFormulawith the givennamewhich is declared in this type. Any formula defined in the super types will not be returned.- Parameters:
name- The name of theFormula- Returns:
Formuladeclared 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
Returns whether theFormulafor the specifiednameis declared in this type. -
getTableUsages
Returns a list ofTableUsageswhich are declared in this type or in any super type.- Returns:
- All
TableUsagesaccessible in this product type.
-
getGenerationJavaClass
-
getGenerationJavaInterface
-
getGenerationDeclarationClass
-
getSuperType
Description copied from class:TypeReturns this type's super type ornullif it has none.- Specified by:
getSuperTypein classType- See Also:
-
findSuperType
Description copied from class:TypeReturns this type's super type ifpresent, otherwise anempty Optional.- Overrides:
findSuperTypein classType
-
getDeclaredAttribute
Description copied from class:TypeReturns the declared attribute at the givenindex.- Overrides:
getDeclaredAttributein classType
-
getDeclaredAttribute
Description copied from class:TypeReturns the attribute with the givennamedeclared in this type. Attributes defined in the type's super types are not returned.- Specified by:
getDeclaredAttributein classType- Parameters:
name- the name of the attribute- Returns:
- the attribute if it was found in this type
- See Also:
-
getDeclaredAttributes
Description copied from class:TypeReturns a list containing all attributes declared in this model type. Attributes defined in the type's super types are not returned.- Specified by:
getDeclaredAttributesin classType- Returns:
- the list of attributes declared in this type
-
getAttribute
Description copied from class:TypeReturns the attribute with the givennamedeclared in this type or one of it's super types.- Overrides:
getAttributein classType
-
getAttributes
Description copied from class:TypeReturns a list containing the type's attributes including those defined in the type's super types.- Specified by:
getAttributesin classType- Returns:
- the list of all attributes declared in this type or in any supertype
-
getFormula
Returns theFormulafor 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
Formulawith the specified name - Throws:
IllegalArgumentException- if there is no table usage with the specified name- Since:
- 24.7
-
getFormulas
- Returns:
- all formulas defined on this type.
- Since:
- 24.7
-
isAttributeDeclared
Description copied from class:TypeReturns whether the attribute with the givennameis declared in this type. Attributes defined in the type's super types are not considered.- Specified by:
isAttributeDeclaredin classType- Parameters:
name- the name of the attribute- Returns:
trueif the attribute is declared in this type,falseif not
-
getDeclaredAssociation
Description copied from class:TypeReturns the association at the givenindex. Associations defined in the type's super types are not returned.- Overrides:
getDeclaredAssociationin classType
-
getDeclaredAssociation
Description copied from class:TypeReturns the association with the givennamedeclared 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:
getDeclaredAssociationin classType- Parameters:
name- the name of the association- Returns:
- the association if it was found in this type
- See Also:
-
getDeclaredAssociations
Description copied from class:TypeReturns a list containing all associations declared in this type. Associations defined in the type's super types are not returned.- Specified by:
getDeclaredAssociationsin classType- Returns:
- the list of associations declared in this type
-
isAssociationDeclared
Description copied from class:TypeReturns whether the association with the givennameis declared in this type. Associations defined in the type's super types are not considered.- Specified by:
isAssociationDeclaredin classType- Parameters:
name- the name of the association- Returns:
trueif the association is declared in this type,falseif not- See Also:
-
getAssociation
Description copied from class:TypeReturns the association with the givennamedeclared in this type or one of it's super types. The name could either be the singular or the plural name.- Overrides:
getAssociationin classType
-
getAssociations
Description copied from class:TypeReturns the type's associations including those defined in it's super types.- Specified by:
getAssociationsin classType- 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:TypeSearches for a field with the given annotation that matches the condition defined by amatcher. Only fields in this type's declaration class are considered, thus no fields from super classes are found.- Overrides:
findDeclaredFieldin classType- Parameters:
annotationClass- the class of the annotation the field must be annotated withmatcher- 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 validatemessages- aMessageList, to which validation messages may be addedcontext- theIValidationContext, needed to determine theLocalein which to createMessages- Throws:
IllegalArgumentException- if the given product component does not match this type- Since:
- 25.1
-