org.faktorips.runtime.modeltype.internal
Class ModelType

java.lang.Object
  extended by org.faktorips.runtime.modeltype.internal.AbstractModelElement
      extended by org.faktorips.runtime.modeltype.internal.ModelType
All Implemented Interfaces:
IModelElement, IModelType

public class ModelType
extends AbstractModelElement
implements IModelType

Author:
Daniel Hohenberger

Field Summary
 
Fields inherited from interface org.faktorips.runtime.modeltype.IModelType
PROPERTY_CLASS, PROPERTY_SUPERTYPE, XML_TAG
 
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
ModelType(IRuntimeRepository repository)
           
 
Method Summary
 IModelTypeAssociation getAssociation(String name)
          Returns the association with the given name declared in this type or one of it's super types.
 List<IModelTypeAssociation> getAssociations()
          Returns the type's associations including those defined in it's super types.
 IModelTypeAttribute getAttribute(String name)
          Returns the attribute with the given name declared in this type or one of it's super types.
 List<IModelTypeAttribute> getAttributes()
          Returns a list containing the type's attributes including those defined in the type's super types.
 Object getAttributeValue(IModelObject source, String attributeName)
          Returns the value of the given model object's attribute identified by the given attribute name.
 IModelTypeAssociation getDeclaredAssociation(int index)
          Returns the association at the given index.
 IModelTypeAssociation getDeclaredAssociation(String name)
          Returns the association with the given name declared in this type.
 List<IModelTypeAssociation> getDeclaredAssociations()
          Returns a list containing all associations declared in this model type.
 IModelTypeAttribute getDeclaredAttribute(int index)
          Returns the declared attribute at the given index.
 IModelTypeAttribute getDeclaredAttribute(String name)
          Returns the attribute with the given name declared in this type.
 List<IModelTypeAttribute> getDeclaredAttributes()
          Returns a list containing all attributes declared in this model type.
 Class<?> getJavaClass()
          Returns the Java class for this type.
 Class<?> getJavaInterface()
          Returns the Java interface for this type.
 IModelType getSuperType()
          Returns this model type's super type or null if it has none.
 List<IModelObject> getTargetObjects(IModelObject source, String associationName)
          Returns a list of the target(s) of the given model object's association identified by the given association name.
 void initFromXml(XMLStreamReader parser)
          Initializes the model element's state with the data stored in the xml element at the parser's current position.
 void setAttributeValue(IModelObject source, String attributeName, Object value)
          Sets the given model object's attribute identified by the given name to the given value.
 String toString()
           
 
Methods inherited from class org.faktorips.runtime.modeltype.internal.AbstractModelElement
getDescription, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRepository, initDescriptionsFromXml, initExtPropertiesFromXml, initLabelFromXml, initLabelsFromXml, setExtensionPropertyValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.faktorips.runtime.modeltype.IModelElement
getDescription, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRepository, initExtPropertiesFromXml
 

Constructor Detail

ModelType

public ModelType(IRuntimeRepository repository)
Method Detail

getDeclaredAssociation

public IModelTypeAssociation getDeclaredAssociation(int index)
Description copied from interface: IModelType
Returns the association at the given index. Associations defined in the type's super types are not returned.

Specified by:
getDeclaredAssociation in interface IModelType

getDeclaredAssociation

public IModelTypeAssociation getDeclaredAssociation(String name)
Description copied from interface: IModelType
Returns the association with the given name declared in this type. Associations defined in the type's super types are not considered.

Specified by:
getDeclaredAssociation in interface IModelType

getDeclaredAssociations

public List<IModelTypeAssociation> getDeclaredAssociations()
Description copied from interface: IModelType
Returns a list containing all associations declared in this model type. Associations defined in the type's super types are not returned.

Specified by:
getDeclaredAssociations in interface IModelType

getAssociations

public List<IModelTypeAssociation> getAssociations()
Description copied from interface: IModelType
Returns the type's associations including those defined in it's super types.

Specified by:
getAssociations in interface IModelType

getAssociation

public IModelTypeAssociation getAssociation(String name)
Description copied from interface: IModelType
Returns the association with the given name declared in this type or one of it's super types.

Specified by:
getAssociation in interface IModelType

getTargetObjects

public List<IModelObject> getTargetObjects(IModelObject source,
                                           String associationName)
Description copied from interface: IModelType
Returns a list of the target(s) of the given model object's association identified by the given association name.

Specified by:
getTargetObjects in interface IModelType
Parameters:
source - a model object corresponding to this model type
associationName - the name of the association
Returns:
a list of the target(s) of the given model object's association identified by the given association name

getDeclaredAttribute

public IModelTypeAttribute getDeclaredAttribute(int index)
Description copied from interface: IModelType
Returns the declared attribute at the given index.

Specified by:
getDeclaredAttribute in interface IModelType

getDeclaredAttribute

public IModelTypeAttribute getDeclaredAttribute(String name)
Description copied from interface: IModelType
Returns the attribute with the given name declared in this type. Attributes defined in the type's super types are not returned.

Specified by:
getDeclaredAttribute in interface IModelType

getAttribute

public IModelTypeAttribute getAttribute(String name)
Description copied from interface: IModelType
Returns the attribute with the given name declared in this type or one of it's super types.

Specified by:
getAttribute in interface IModelType

getDeclaredAttributes

public List<IModelTypeAttribute> getDeclaredAttributes()
Description copied from interface: IModelType
Returns a list containing all attributes declared in this model type. Attributes defined in the type's super types are not returned.

Specified by:
getDeclaredAttributes in interface IModelType

getAttributes

public List<IModelTypeAttribute> getAttributes()
Description copied from interface: IModelType
Returns a list containing the type's attributes including those defined in the type's super types.

Specified by:
getAttributes in interface IModelType

getAttributeValue

public Object getAttributeValue(IModelObject source,
                                String attributeName)
Description copied from interface: IModelType
Returns the value of the given model object's attribute identified by the given attribute name.

Specified by:
getAttributeValue in interface IModelType
Parameters:
source - a model object corresponding to this model type
attributeName - the name of the attribute
Returns:
the value of the given model object's attribute identified by the given attribute name
See Also:
IModelTypeAttribute.getValue(IModelObject)

setAttributeValue

public void setAttributeValue(IModelObject source,
                              String attributeName,
                              Object value)
Description copied from interface: IModelType
Sets the given model object's attribute identified by the given name to the given value. This only works for attributes of type IModelTypeAttribute.AttributeType.CHANGEABLE.

Specified by:
setAttributeValue in interface IModelType
Parameters:
source - a model object corresponding to this model type
value - an object of the datatype for the IModelTypeAttribute by the given name
See Also:
IModelTypeAttribute.setValue(IModelObject, Object)

getJavaClass

public Class<?> getJavaClass()
                      throws ClassNotFoundException
Description copied from interface: IModelType
Returns the Java class for this type.

Specified by:
getJavaClass in interface IModelType
Throws:
ClassNotFoundException - if the class could not be loaded.

getJavaInterface

public Class<?> getJavaInterface()
                          throws ClassNotFoundException
Description copied from interface: IModelType
Returns the Java interface for this type.

Specified by:
getJavaInterface in interface IModelType
Throws:
ClassNotFoundException - if the class could not be loaded.

getSuperType

public IModelType getSuperType()
Description copied from interface: IModelType
Returns this model type's super type or null if it has none.

Specified by:
getSuperType in interface IModelType

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
Overrides:
initFromXml in class AbstractModelElement
Throws:
XMLStreamException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015. All rights reserved.