org.faktorips.runtime.modeltype.internal
Class AbstractModelElement

java.lang.Object
  extended by org.faktorips.runtime.modeltype.internal.AbstractModelElement
All Implemented Interfaces:
IModelElement
Direct Known Subclasses:
ModelType, ModelTypeAssociation, ModelTypeAttribute

public class AbstractModelElement
extends Object
implements IModelElement

Author:
Daniel Hohenberger

Field Summary
 
Fields inherited from interface org.faktorips.runtime.modeltype.IModelElement
DESCRIPTIONS_PROPERTY_LOCALE, DESCRIPTIONS_XML_TAG, DESCRIPTIONS_XML_WRAPPER_TAG, EXTENSION_PROPERTIES_PROPERTY_ID, EXTENSION_PROPERTIES_PROPERTY_NULL, EXTENSION_PROPERTIES_XML_TAG, EXTENSION_PROPERTIES_XML_WRAPPER_TAG, LABELS_PROPERTY_LOCALE, LABELS_PROPERTY_PLURAL_VALUE, LABELS_PROPERTY_VALUE, LABELS_XML_TAG, LABELS_XML_WRAPPER_TAG, PROPERTY_NAME
 
Constructor Summary
AbstractModelElement(IRuntimeRepository repository)
           
 
Method Summary
 String getDescription(Locale locale)
          Returns the description for the given locale.
 Set<String> getExtensionPropertyIds()
          Returns a set of the extension property ids defined for this element.
 Object getExtensionPropertyValue(String propertyId)
           
 String getLabel(Locale locale)
          Returns the label for the given locale.
 String getName()
          Returns the name of this model type.
 IRuntimeRepository getRepository()
          Returns the repository this model element belongs to.
protected  void initDescriptionsFromXml(XMLStreamReader parser)
           
 void initExtPropertiesFromXml(XMLStreamReader parser)
          Initializes the model element's extension properties with the data stored in the xml element at the parser's current position.
 void initFromXml(XMLStreamReader parser)
          Initializes the model element's state with the data stored in the xml element at the parser's current position.
protected  void initLabelFromXml(XMLStreamReader parser)
           
protected  void initLabelsFromXml(XMLStreamReader parser)
           
 void setExtensionPropertyValue(String propertyId, Object value)
          Sets the value of the extension property propertyId.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractModelElement

public AbstractModelElement(IRuntimeRepository repository)
Method Detail

getLabel

public String getLabel(Locale locale)
Description copied from interface: IModelElement
Returns the label for the given locale.

Returns the element's name if no label exists for the given locale.

Specified by:
getLabel in interface IModelElement

getDescription

public String getDescription(Locale locale)
Description copied from interface: IModelElement
Returns the description for the given locale.

Returns an empty string if no description exists for the given locale.

Specified by:
getDescription in interface IModelElement

getExtensionPropertyValue

public Object getExtensionPropertyValue(String propertyId)
Specified by:
getExtensionPropertyValue in interface IModelElement
Parameters:
propertyId - the id of the desired extension property. Returns the value of the extension property defined by the given propertyId or null if the extension property's isNull attribute is true.

setExtensionPropertyValue

public void setExtensionPropertyValue(String propertyId,
                                      Object value)
Sets the value of the extension property propertyId.


getName

public String getName()
Description copied from interface: IModelElement
Returns the name of this model type.

Specified by:
getName in interface IModelElement

initFromXml

public void initFromXml(XMLStreamReader parser)
                 throws XMLStreamException
Description copied from interface: IModelElement
Initializes the model element's state with the data stored in the xml element at the parser's current position.

Specified by:
initFromXml in interface IModelElement
Throws:
XMLStreamException

initDescriptionsFromXml

protected final void initDescriptionsFromXml(XMLStreamReader parser)
                                      throws XMLStreamException
Throws:
XMLStreamException

initLabelsFromXml

protected final void initLabelsFromXml(XMLStreamReader parser)
                                throws XMLStreamException
Throws:
XMLStreamException

initLabelFromXml

protected void initLabelFromXml(XMLStreamReader parser)

getExtensionPropertyIds

public Set<String> getExtensionPropertyIds()
Description copied from interface: IModelElement
Returns a set of the extension property ids defined for this element.

Specified by:
getExtensionPropertyIds in interface IModelElement

initExtPropertiesFromXml

public void initExtPropertiesFromXml(XMLStreamReader parser)
                              throws XMLStreamException
Description copied from interface: IModelElement
Initializes the model element's extension properties with the data stored in the xml element at the parser's current position. This method assumes that the element is <ExtensionProperties>.

Specified by:
initExtPropertiesFromXml in interface IModelElement
Throws:
XMLStreamException

getRepository

public IRuntimeRepository getRepository()
Description copied from interface: IModelElement
Returns the repository this model element belongs to. This method never returns null.

Specified by:
getRepository in interface IModelElement


Copyright © 2015. All rights reserved.