Package org.faktorips.runtime.model.type
Class ModelElement
java.lang.Object
org.faktorips.runtime.model.type.ModelElement
- Direct Known Subclasses:
EnumAttribute,EnumType,TableColumn,TableStructure,Type,TypePart
An element from the design time model representation as returned from
IpsModel. Defines
basic properties shared by all such elements such as name,
label, description and
extension properties.-
Constructor Summary
ConstructorsConstructorDescriptionModelElement(String name, IpsExtensionProperties extensionProperties, Optional<Deprecation> deprecation) -
Method Summary
Modifier and TypeMethodDescriptionprotected MessagesHelpercreateMessageHelper(IpsDocumented documentedAnnotation, ClassLoader classLoader) getDescription(Locale locale) Returns the description for this model element in the specified locale.protected StringgetDocumentation(Locale locale, DocumentationKind type, String fallback) getExtensionPropertyValue(String propertyId) Returns the value for the given extension property identified by the specified id.Returns the label for this model element in the specified locale.protected abstract MessagesHelperprotected abstract StringgetMessageKey(DocumentationKind messageType) getName()protected static ObjectgetRelevantProductObject(IProductComponent productComponent, Calendar effectiveDate, boolean changingOverTime) If thechangingOverTimeisfalse, the given product component is returned.protected static ObjectinvokeField(Field field, Object source) protected static ObjectinvokeMethod(Method method, Object source, Object... arguments) booleantoString()
-
Constructor Details
-
ModelElement
public ModelElement(String name, IpsExtensionProperties extensionProperties, Optional<Deprecation> deprecation)
-
-
Method Details
-
getName
- Returns:
- the qualified IPS object name
-
getLabel
Returns the label for this model element in the specified locale. If there is no label in the specified locale, it tries to find the label in the default locale. If there is also no label in the default locale the element's name is returned.- Returns:
- the label for the given locale or the element's name if no label exists for the given locale nor in the default locale
-
getDescription
Returns the description for this model element in the specified locale. If there is no description in the specified locale, it tries to find the description in the default locale. If there is also no description in the default locale it returns the empty string.- Returns:
- the description for the given locale or an empty string if no description exists for the given locale
-
getMessageKey
-
getDocumentation
-
getMessageHelper
-
createMessageHelper
protected MessagesHelper createMessageHelper(IpsDocumented documentedAnnotation, ClassLoader classLoader) -
getExtensionPropertyValue
Returns the value for the given extension property identified by the specified id.Note: At the moment only
Stringis supported as extension property value. This method returnsObjectfor future changes.- Returns:
- the value of the extension property defined by the given
propertyIdornullif the extension property'sisNullattribute istrue - Throws:
IllegalArgumentException- if no such property exists
-
getExtensionPropertyIds
- Returns:
- a set of the extension property ids defined for this element
-
invokeMethod
-
invokeField
-
getRelevantProductObject
protected static Object getRelevantProductObject(IProductComponent productComponent, Calendar effectiveDate, boolean changingOverTime) If thechangingOverTimeisfalse, the given product component is returned. If changing over time istrue, the effective date is used to determine the generation to use. If the effective date isnull, the latest product component generation is returned.- Parameters:
productComponent- the product component to potentially retrieve a generation fromeffectiveDate- the date to select the product component generation. Ifnullthe latest generation is used. Is ignored if the model element's configuration is not changing over time.changingOverTime- whether the model element is changing over time.- Returns:
- The given product component or the effective generation, depending on changingOverTime and effectiveDate.
-
toString
-
isDeprecated
public boolean isDeprecated() -
getDeprecation
-