Package org.faktorips.runtime.model.type
Class PolicyCmptType
- java.lang.Object
-
- org.faktorips.runtime.model.type.ModelElement
-
- org.faktorips.runtime.model.type.Type
-
- org.faktorips.runtime.model.type.PolicyCmptType
-
public class PolicyCmptType extends Type
Corresponds to a design timeIPolicyCmptType.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.faktorips.runtime.model.type.Type
Type.AnnotatedElementMatcher<T extends java.lang.annotation.Annotation>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringKIND_NAME
-
Constructor Summary
Constructors Constructor Description PolicyCmptType(java.lang.String name, AnnotatedDeclaration annotatedDeclararation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<PolicyCmptType>findSuperType()Returns this type's super type ifpresent, otherwise anempty Optional.PolicyAssociationgetAssociation(java.lang.String name)Returns the association with the givennamedeclared in this type or one of it's super types.java.util.List<PolicyAssociation>getAssociations()Returns the type's associations including those defined in it's super types.PolicyAttributegetAttribute(java.lang.String name)Returns the attribute with the givennamedeclared in this type or one of it's super types.java.util.List<PolicyAttribute>getAttributes()Returns a list containing the type's attributes including those defined in the type's super types.PolicyAssociationgetDeclaredAssociation(int index)Returns the association at the givenindex.PolicyAssociationgetDeclaredAssociation(java.lang.String name)Returns the association with the givennamedeclared in this type.java.util.List<PolicyAssociation>getDeclaredAssociations()Returns a list containing all associations declared in this type.PolicyAttributegetDeclaredAttribute(int index)Returns the declared attribute at the givenindex.PolicyAttributegetDeclaredAttribute(java.lang.String name)Returns the attribute with the givennamedeclared in this type.java.util.List<PolicyAttribute>getDeclaredAttributes()Returns a list containing all attributes declared in this model type.ValidationRulegetDeclaredValidationRule(int index)Returns the declaredValidationRuleat the givenindex.ValidationRulegetDeclaredValidationRule(java.lang.String name)Returns theValidationRulewith the givennamedeclared in this type.java.util.List<ValidationRule>getDeclaredValidationRules()Returns a list containing allValidationRulesdeclared in this model type.protected java.lang.StringgetKindName()java.util.List<ModelObjectAttribute>getModelObjectAttributes(IModelObject modelObject)ProductCmptTypegetProductCmptType()Returns theProductCmptTypethat configures this policy component type.PolicyCmptTypegetSuperType()Returns this type's super type ornullif it has none.ValidationRulegetValidationRule(java.lang.String name)Returns theValidationRulewith the givennamedeclared in this type or one of its super types.java.util.List<ValidationRule>getValidationRules()Returns a list containing all theValidationRulesincluding those defined in the super types.booleanisAssociationDeclared(java.lang.String name)Returns whether the association with the givennameis declared in this type.booleanisAttributeDeclared(java.lang.String name)Returns whether the attribute with the givennameis declared in this type.booleanisConfiguredByProductCmptType()Returns whether this policy component type is configured by a product component type.booleanisValidationRuleDeclared(java.lang.String name)Returns whether theValidationRulewith the givennameis declared in this type.-
Methods inherited from class org.faktorips.runtime.model.type.Type
findDeclaredField, findDeclaredMethod, findJavaInterface, getAnnotatedDeclaration, getDeclarationClass, getDeclaredFields, getDeclaredMethods, getJavaClass, getJavaInterface, getMessageHelper, getMessageKey, isAssociationPresent, isAttributePresent, isSuperTypePresent, searchDeclaredMethod, toString
-
Methods inherited from class org.faktorips.runtime.model.type.ModelElement
createMessageHelper, getDeprecation, getDescription, getDocumentation, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRelevantProductObject, invokeField, invokeMethod, isDeprecated
-
-
-
-
Field Detail
-
KIND_NAME
public static final java.lang.String KIND_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PolicyCmptType
public PolicyCmptType(java.lang.String name, AnnotatedDeclaration annotatedDeclararation)
-
-
Method Detail
-
getKindName
protected java.lang.String getKindName()
- Specified by:
getKindNamein classType
-
isConfiguredByProductCmptType
public boolean isConfiguredByProductCmptType()
Returns whether this policy component type is configured by a product component type. If this method returnstrueyou could usegetProductCmptType()to get the type of the configuring product.- Returns:
trueif this policy component type is configured elsefalse
-
getProductCmptType
public ProductCmptType getProductCmptType()
Returns theProductCmptTypethat configures this policy component type. Throws anIllegalArgumentExceptionif this policy component type is not configured. UseisConfiguredByProductCmptType()to check whether it is configured or not.- Returns:
- the
ProductCmptTypethat configures this policy component type - Throws:
java.lang.NullPointerException- if this policy component type is not configured
-
getSuperType
public PolicyCmptType getSuperType()
Description copied from class:TypeReturns this type's super type ornullif it has none.- Specified by:
getSuperTypein classType- See Also:
findSuperType for null-safe processing
-
findSuperType
public java.util.Optional<PolicyCmptType> findSuperType()
Description copied from class:TypeReturns this type's super type ifpresent, otherwise anempty Optional.- Overrides:
findSuperTypein classType
-
getDeclaredAttribute
public PolicyAttribute getDeclaredAttribute(java.lang.String name)
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:
Type.isAttributeDeclared(String)
-
getDeclaredAttribute
public PolicyAttribute getDeclaredAttribute(int index)
Description copied from class:TypeReturns the declared attribute at the givenindex.- Overrides:
getDeclaredAttributein classType
-
getDeclaredAttributes
public java.util.List<PolicyAttribute> 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
public PolicyAttribute getAttribute(java.lang.String name)
Description copied from class:TypeReturns the attribute with the givennamedeclared in this type or one of it's super types.- Overrides:
getAttributein classType
-
getAttributes
public java.util.List<PolicyAttribute> 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
-
getModelObjectAttributes
public java.util.List<ModelObjectAttribute> getModelObjectAttributes(IModelObject modelObject)
- Parameters:
modelObject- theIModelObjectlinked to the attributes- Returns:
- a list with
ModelObjectAttributes - Since:
- 21.6
-
getDeclaredAssociation
public PolicyAssociation getDeclaredAssociation(java.lang.String name)
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:
Type.isAssociationDeclared(String)
-
getDeclaredAssociation
public PolicyAssociation getDeclaredAssociation(int index)
Description copied from class:TypeReturns the association at the givenindex. Associations defined in the type's super types are not returned.- Overrides:
getDeclaredAssociationin classType
-
getDeclaredAssociations
public java.util.List<PolicyAssociation> 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
-
getAssociation
public PolicyAssociation getAssociation(java.lang.String name)
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
public java.util.List<PolicyAssociation> 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
-
isAssociationDeclared
public boolean isAssociationDeclared(java.lang.String name)
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:
Type.isAssociationPresent(String)
-
isAttributeDeclared
public boolean isAttributeDeclared(java.lang.String name)
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
-
getDeclaredValidationRule
public ValidationRule getDeclaredValidationRule(java.lang.String name)
Returns theValidationRulewith the givennamedeclared in this type.ValidationRulesdefined in the type's super types is not returned.- Parameters:
name- the name of theValidationRule- Returns:
ValidationRulewith the givennameif it was found in this type- Throws:
java.lang.IllegalArgumentException- if noValidationRulewith the givennameexists
-
getDeclaredValidationRule
public ValidationRule getDeclaredValidationRule(int index)
Returns the declaredValidationRuleat the givenindex.- Parameters:
index- the position at which theValidationRuleis expected in the list of declaredValidationRules- Returns:
- the declared
ValidationRuleat the givenindex - Throws:
java.lang.IndexOutOfBoundsException- if noValidationRuleexists for the givenindex
-
getDeclaredValidationRules
public java.util.List<ValidationRule> getDeclaredValidationRules()
Returns a list containing allValidationRulesdeclared in this model type.ValidationRulesdefined in the type's super types are not returned.- Returns:
- the list of
ValidationRulesdeclared in this type
-
getValidationRule
public ValidationRule getValidationRule(java.lang.String name)
Returns theValidationRulewith the givennamedeclared in this type or one of its super types.- Parameters:
name- the name of theValidationRule- Returns:
ValidationRulewith the givennamedeclared in this type or one of its super types- Throws:
java.lang.IllegalArgumentException- if noValidationRulewith the givennameexists
-
getValidationRules
public java.util.List<ValidationRule> getValidationRules()
Returns a list containing all theValidationRulesincluding those defined in the super types.- Returns:
- the list of all
ValidationRulesdeclared in this type and in its super types
-
isValidationRuleDeclared
public boolean isValidationRuleDeclared(java.lang.String name)
Returns whether theValidationRulewith the givennameis declared in this type.ValidationRulesdefined in the type's super types are not considered.- Parameters:
name- the name of theValidationRule- Returns:
trueif theValidationRuleis declared in this type,falseif not
-
-