CMI documentation

com.sap.tc.cmi.model
Interface ICMIGenericModelClass

All Superinterfaces:
ICMIModelClass

public interface ICMIGenericModelClass
extends ICMIModelClass

Interface for a generic model class. Model classes that implement this interface are treated specially from the context. Instead of using reflection to access attributes, it uses getAttributeValue(String) and setAttributeValue(String, Object). This type can be called, extended or implemented by applications or frameworks using CMI.

Version:
$Id: //tc/CommonModelInterface/630_VAL_REL/src/_cmi_api/java/com/sap/tc/cmi/model/ICMIGenericModelClass.java#1 $

Method Summary
 boolean addRelatedModelObject(java.lang.String targetRoleName, ICMIModelClass o)
          adds o to the relation role targetRoleName according to the add method in the java.util.Collection interface.
 ICMIModelClassInfo associatedModelClassInfo()
          returns the metadata, i.e.
 java.lang.Object getAttributeValue(java.lang.String name)
          Returns the value of the attribute with the given name as an Object.
 ICMIModelClass getRelatedModelObject(java.lang.String targetRoleName)
          Returns null or the appropriate object of type ICMIModelClass according to the relation role in targetRoleName, which must have the cardinality 1 or 0..1.
 java.util.Collection getRelatedModelObjects(java.lang.String targetRoleName)
          Returns the appropriate collection of objects of type ICMIModelClass according to the relation role in targetRoleName, which must have the cardinality * or 1..*.
 boolean removeRelatedModelObject(java.lang.String targetRoleName, ICMIModelClass o)
          removes o from the relation role targetRoleName according to the remove method in the java.util.Collection interface.
 void setAttributeValue(java.lang.String name, java.lang.Object value)
          Sets the attribute to given value.
 void setRelatedModelObject(java.lang.String targetRoleName, ICMIModelClass o)
          Sets the relation role targetRoleName of an x:0..1 or x:1 relation to object o of type ICMIModelClass.
 void setRelatedModelObjects(java.lang.String targetRoleName, java.util.Collection col)
          sets the relation role targetRoleName of an x:* or x:1..* relation to the Collection col, which contains exclusively objects of type ICMIModelClass.
 
Methods inherited from interface com.sap.tc.cmi.model.ICMIModelClass
associatedModel
 

Method Detail

getAttributeValue

public java.lang.Object getAttributeValue(java.lang.String name)
Returns the value of the attribute with the given name as an Object. It is unspecified, if the attribute is copied, before it is returned, or not.
Throws:
java.lang.IllegalArgumentException - if there is no attribute with the given name

setAttributeValue

public void setAttributeValue(java.lang.String name,
                              java.lang.Object value)
Sets the attribute to given value. It is unspecified, if value is copied, before it is set, or not.
Throws:
java.lang.IllegalArgumentException - if there is no attribute with the given name

getRelatedModelObject

public ICMIModelClass getRelatedModelObject(java.lang.String targetRoleName)
Returns null or the appropriate object of type ICMIModelClass according to the relation role in targetRoleName, which must have the cardinality 1 or 0..1.

If the role is of cardinality 0..1, null can be returned.

If there is no relation with an the given target rolename, an java.lang.IllegalArgumentException is thrown.


setRelatedModelObject

public void setRelatedModelObject(java.lang.String targetRoleName,
                                  ICMIModelClass o)
Sets the relation role targetRoleName of an x:0..1 or x:1 relation to object o of type ICMIModelClass.

If o is null and the cardinality of the relation role is 1, a java.lang.NullPointerException exception is thrown.

If this has no target relation role with the given targetRoleName, an java.lang.IllegalArgumentException is thrown.

If the model class or the model are read only, or if the model implementation doesn't support this method, an java.lang.UnsupportedOperationException is thrown.

If the method throws an exception for any of the above reasons, no changes have been made of course.

getRelatedModelObjects

public java.util.Collection getRelatedModelObjects(java.lang.String targetRoleName)
Returns the appropriate collection of objects of type ICMIModelClass according to the relation role in targetRoleName, which must have the cardinality * or 1..*.

The collection should be immutable.

If the role is of cardinality 0..*, the collection could be empty, but not null.

If there is no relation with the given target role name, an java.lang.IllegalArgumentException is thrown.

If the method throws an exception, no changes are made of course.

setRelatedModelObjects

public void setRelatedModelObjects(java.lang.String targetRoleName,
                                   java.util.Collection col)
sets the relation role targetRoleName of an x:* or x:1..* relation to the Collection col, which contains exclusively objects of type ICMIModelClass.

If col is null, a java.lang.NullPointerException exception is thrown.

If col is empty and the cardinality of the relation role is 1..*, a java.lang.NullPointerException exception is thrown.

If this has no target relation role with the given targetRoleName, a java.lang.IllegalArgumentException is thrown.

If the model class or the model are read only, or if the model implementation doesn't support this method, an java.lang.UnsupportedOperationException is thrown.

If the method throws an exception, no changes are made of course.


addRelatedModelObject

public boolean addRelatedModelObject(java.lang.String targetRoleName,
                                     ICMIModelClass o)
adds o to the relation role targetRoleName according to the add method in the java.util.Collection interface.

If o is null, a java.lang.NullPointerException exception is thrown and no changes are made of course.

If this has no target relation role with the given targetRoleName and cardinality * or 1..*, a java.lang.IllegalArgumentException is thrown.

If the model class or the model are read only, or if the model implementation doesn't support this method, an java.lang.UnsupportedOperationException is thrown.

If the method throws an exception, no changes are made of course.


removeRelatedModelObject

public boolean removeRelatedModelObject(java.lang.String targetRoleName,
                                        ICMIModelClass o)
removes o from the relation role targetRoleName according to the remove method in the java.util.Collection interface.

If o is null or o was not in the collection, the method silently returns.

If o is the last element in the relation role, and the cardinality of the role is 1..*, a java.lang.IllegalArgumentException is thrown.

If this has no target relation role with the given targetRoleName and cardinality * or 1..*, a java.lang.IllegalArgumentException is thrown.

If the model class or the model are read only, or if the model implementation doesn't support this method, an java.lang.UnsupportedOperationException is thrown.

If the method throws an exception, no changes are made of course.


associatedModelClassInfo

public ICMIModelClassInfo associatedModelClassInfo()
returns the metadata, i.e. an object of type ICMIModelClassInfo, corresponding to this model class. Each implementation has to support this method and must not return null.
Specified by:
associatedModelClassInfo in interface ICMIModelClass
Following copied from interface: com.sap.tc.cmi.model.ICMIModelClass
Returns:
ICMIModelClassInfo of this ModelClass

CMI documentation

Copyright © 2002 SAP AG. Automatically generated Thu Mar 3 2005, 21:53