|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.cpl.model.IlpDefaultObject
public class IlpDefaultObject
Defines a default implementation for IlpObject instances.
This class can be used as a default instance to add objects to a data source.
Note: Despite being a concrete class implementing IlpObject,
this class does not have a corresponding IlpClass descriptor.
Therefore it cannot be directly used in XML. But objects defined in XML
using a syntax like
IlpDefaultObject.
| Field Summary |
|---|
| Fields inherited from interface ilog.cpl.model.IlpAttributeValueHolder |
|---|
VALUE_NOT_SET |
| Constructor Summary | |
|---|---|
protected |
IlpDefaultObject()
Default constructor used for serialization |
|
IlpDefaultObject(IlpClass ilpClass,
Object identifier)
Constructor. |
|
IlpDefaultObject(IlpClass ilpClass,
Object identifier,
boolean initializeAttributeValues)
Constructor. |
| Method Summary | |
|---|---|
void |
addAttributeValueListener(AttributeValueListener l)
Adds a listener to attribute value changes. |
void |
fireEvent(AttributeValueEvent ev)
Fires the given event to all listeners. |
IlpAttributeGroup |
getAttributeGroup()
Returns the model that defines which attributes are allowed in this instance. |
Object |
getAttributeValue(IlpAttribute a)
Retrieves the value of an attribute of this object. |
Object |
getAttributeValue(String name)
Returns the value of an attribute of this object. |
Object |
getAttributeValueByName(String name)
Deprecated. Please use getAttributeValue instead. |
Object |
getIdentifier()
Returns the identifier of the IlpObject. |
IlpClass |
getIlpClass()
Retrieves the IlpClass corresponding to this object. |
protected Map |
getLocalAttributeValues()
Called only during serialization in IltObject |
protected IlpObjectSupport |
getObjectSupport()
|
boolean |
hasAttributeValue(IlpAttribute a)
Returns true if the requested attribute is part of the
attribute group of this instance and if a value has been set for this
attribute. |
void |
initializeDefaultValues()
This method initializes the attribute values of the object with the default attribute values, if there are any. |
void |
removeAttributeValueListener(AttributeValueListener l)
Removes the given listener to the attribute value changes. |
void |
setAttributeValue(IlpAttribute attribute,
Object value)
Sets the value of an attribute of this object. |
void |
setAttributeValue(String name,
Object value)
Sets the value of an attribute of this object. |
void |
setAttributeValueByName(String name,
Object value)
Deprecated. Please use setAttributeValue instead. |
protected void |
setLocalAttributeValues(Map values)
Called only during deserialization in IltObject |
protected void |
setObjectSupport(IlpObjectSupport s)
Called only during deserialization in IltObject |
String |
toString()
Returns an identifier as a string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected IlpDefaultObject()
public IlpDefaultObject(IlpClass ilpClass,
Object identifier)
IlpClass defining this object and initializes the
attribute values using the default values of the IlpAttributes.
ilpClass - The IlpClass of this object.identifier - The identifier of this instance. See IlpIDGenerator
for a simple identifier generator and IlpObject.getIdentifier()
for the constraints on identifiers.
public IlpDefaultObject(IlpClass ilpClass,
Object identifier,
boolean initializeAttributeValues)
ilpClass - The IlpClass of this object.identifier - The identifier of this instance. See
IlpIDGenerator for
a simple identifier generator and
IlpObject.getIdentifier() for the
constraints on identifiers.initializeAttributeValues - Indicates whether the object should be
initialized using the default attribute
values.| Method Detail |
|---|
public Object getIdentifier()
IlpObject.
This identifier is an Object that can be used to identify
and retrieve this IlpObject. It must be unique.
getIdentifier in interface IlpObjectIlpObject.IlpTypeConverterpublic IlpClass getIlpClass()
IlpClass corresponding to this object.
getIlpClass in interface IlpObjectIlpClass corresponding to this object.public IlpAttributeGroup getAttributeGroup()
getAttributeGroup in interface IlpAttributeValueHolderpublic Object getAttributeValue(IlpAttribute a)
getAttributeValue in interface IlpAttributeValueHoldera - The attribute whose value is to be retrieved.
VALUE_NOT_SET if no
value has been set.public boolean hasAttributeValue(IlpAttribute a)
true if the requested attribute is part of the
attribute group of this instance and if a value has been set for this
attribute.
hasAttributeValue in interface IlpAttributeValueHolder
public void setAttributeValue(IlpAttribute attribute,
Object value)
Object value = o.getAttributeValue(attribute); // Incorrect: the value is stored in the same object. The change is not // taken into account. value.modify(); o.setAttributeValue(attribute,value); // Correct: the new value is stored in a new object. The change is taken // into account. value = value.clone(); // Returns a new object value.modify(); o.setAttributeValue(attribute,value);
setAttributeValue in interface IlpAttributeValueHolderattribute - The attribute whose value is set.value - The new value of the attribute or
VALUE_NOT_SET to remove the value of the
attribute.
IllegalArgumentException - if the value of the attribute cannot be
modified.public void addAttributeValueListener(AttributeValueListener l)
addAttributeValueListener in interface IlpAttributeValueHolderpublic void removeAttributeValueListener(AttributeValueListener l)
removeAttributeValueListener in interface IlpAttributeValueHolderpublic void fireEvent(AttributeValueEvent ev)
fireEvent in interface IlpAttributeValueHolderpublic Object getAttributeValueByName(String name)
getAttributeValue instead.
name - The name of the attribute whose value is to be retrieved.
VALUE_NOT_SET if no
value has been set.
public void setAttributeValueByName(String name,
Object value)
setAttributeValue instead.
name - The name of the attribute whose value is to be changed.value - The new value of the attribute or
VALUE_NOT_SET to remove the value of the
attribute.
IllegalArgumentException - if the value of the attribute cannot be
modified.public Object getAttributeValue(String name)
getAttributeValue in interface IlpAttributeValueHoldername - The name of the attribute.
VALUE_NOT_SET if no
value has been set.
public void setAttributeValue(String name,
Object value)
Object value = o.getAttributeValue(name); // Incorrect: the value is stored in the same object. The change is not // taken into account. value.modify(); o.setAttributeValue(name,value); // Correct: the new value is stored in a new object. The change is taken // into account. value = value.clone(); // Returns a new object value.modify(); o.setAttributeValue(name,value);
setAttributeValue in interface IlpAttributeValueHoldername - The name of the attribute.value - The new value of the attribute or
VALUE_NOT_SET to remove the value of the
attribute.
IllegalArgumentException - if the value of the attribute cannot be
modified.public void initializeDefaultValues()
VALUE_NOT_SET) AND that have not been set
in another way, using, for example, setAttributeValue.
initializeDefaultValues in interface IlpObjectpublic String toString()
toString in class Objectprotected Map getLocalAttributeValues()
protected void setLocalAttributeValues(Map values)
protected void setObjectSupport(IlpObjectSupport s)
protected IlpObjectSupport getObjectSupport()
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||