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 Object
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 Details

  • Method Details

    • getName

      public String getName()
      Returns:
      the qualified IPS object name
    • getLabel

      public String getLabel(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 String getDescription(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 String getMessageKey(DocumentationKind messageType)
    • getDocumentation

      protected String getDocumentation(Locale locale, DocumentationKind type, String fallback)
    • getMessageHelper

      protected abstract MessagesHelper getMessageHelper()
    • createMessageHelper

      protected MessagesHelper createMessageHelper(IpsDocumented documentedAnnotation, ClassLoader classLoader)
    • getExtensionPropertyValue

      public Object getExtensionPropertyValue(String propertyId)
      Returns the value for the given extension property identified by the specified id.

      Note: At the moment only String is supported as extension property value. This method returns Object for future changes.

      Returns:
      the value of the extension property defined by the given propertyId or null if the extension property's isNull attribute is true
      Throws:
      IllegalArgumentException - if no such property exists
    • getExtensionPropertyIds

      public Set<String> getExtensionPropertyIds()
      Returns:
      a set of the extension property ids defined for this element
    • invokeMethod

      protected static Object invokeMethod(Method method, Object source, Object... arguments)
    • invokeField

      protected static Object invokeField(Field field, Object source)
    • getRelevantProductObject

      protected static IProductObject getRelevantProductObject(IProductComponent productComponent, @CheckForNull Calendar effectiveDate, boolean changingOverTime)
      If the changingOverTime is false, the given product component is returned. If changing over time is true, the effective date is used to determine the generation to use. If the effective date is null, the latest product component generation is returned.
      Parameters:
      productComponent - the product component to potentially retrieve a generation from
      effectiveDate - the date to select the product component generation. If null the 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.
    • getRelevantProductObject

      protected static IProductObject getRelevantProductObject(IProductComponentGeneration generation, boolean changingOverTime)
      If the changingOverTime is true, the given product component generation is returned. If changing over time is false, the generation's product component is returned.
      Parameters:
      generation - the product component generation to use when 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 String toString()
      Overrides:
      toString in class Object
    • isDeprecated

      public boolean isDeprecated()
    • getDeprecation

      public Optional<Deprecation> getDeprecation()