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
public abstract class ModelElement extends java.lang.ObjectAn element from the design time model representation as returned fromIpsModel. Defines basic properties shared by all such elements such as name, label, description and extension properties.
-
-
Constructor Summary
Constructors Constructor Description ModelElement(java.lang.String name, IpsExtensionProperties extensionProperties)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected MessagesHelpercreateMessageHelper(IpsDocumented documentedAnnotation, java.lang.ClassLoader classLoader)java.lang.StringgetDescription(java.util.Locale locale)Returns the description for this model element in the specified locale.protected java.lang.StringgetDocumentation(java.util.Locale locale, DocumentationKind type, java.lang.String fallback)java.util.Set<java.lang.String>getExtensionPropertyIds()java.lang.ObjectgetExtensionPropertyValue(java.lang.String propertyId)Returns the value for the given extension property identified by the specified id.java.lang.StringgetLabel(java.util.Locale locale)Returns the label for this model element in the specified locale.protected abstract MessagesHelpergetMessageHelper()protected abstract java.lang.StringgetMessageKey(DocumentationKind messageType)java.lang.StringgetName()protected static java.lang.ObjectgetRelevantProductObject(IProductComponent productComponent, java.util.Calendar effectiveDate, boolean changingOverTime)If thechangingOverTimeisfalse, the given product component is returned.protected java.lang.ObjectinvokeField(java.lang.reflect.Field field, java.lang.Object source)protected java.lang.ObjectinvokeMethod(java.lang.reflect.Method method, java.lang.Object source, java.lang.Object... arguments)java.lang.StringtoString()
-
-
-
Constructor Detail
-
ModelElement
public ModelElement(java.lang.String name, IpsExtensionProperties extensionProperties)
-
-
Method Detail
-
getName
public java.lang.String getName()
- Returns:
- the qualified IPS object name
-
getLabel
public java.lang.String getLabel(java.util.Locale locale)
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
public java.lang.String getDescription(java.util.Locale locale)
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
protected abstract java.lang.String getMessageKey(DocumentationKind messageType)
-
getDocumentation
protected java.lang.String getDocumentation(java.util.Locale locale, DocumentationKind type, java.lang.String fallback)
-
getMessageHelper
protected abstract MessagesHelper getMessageHelper()
-
createMessageHelper
protected MessagesHelper createMessageHelper(IpsDocumented documentedAnnotation, java.lang.ClassLoader classLoader)
-
getExtensionPropertyValue
public java.lang.Object getExtensionPropertyValue(java.lang.String propertyId)
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:
java.lang.IllegalArgumentException- if no such property exists
-
getExtensionPropertyIds
public java.util.Set<java.lang.String> getExtensionPropertyIds()
- Returns:
- a set of the extension property ids defined for this element
-
invokeMethod
protected java.lang.Object invokeMethod(java.lang.reflect.Method method, java.lang.Object source, java.lang.Object... arguments)
-
invokeField
protected java.lang.Object invokeField(java.lang.reflect.Field field, java.lang.Object source)
-
getRelevantProductObject
protected static java.lang.Object getRelevantProductObject(IProductComponent productComponent, java.util.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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-