public class IlpDefaultObject extends Object implements IlpObject
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
<classes>
<class>
<name>MyClass</name>
</class>
</classes>
<addObject id="MyObject #5">
<class>MyClass</class>
</addObject>
will in fact be represented as instances of IlpDefaultObject.
VALUE_NOT_SET| Modifier | Constructor and Description |
|---|---|
protected |
IlpDefaultObject()
Default constructor used for serialization
|
|
IlpDefaultObject(IlpClass ilpClass,
Object identifier)
Constructor.
|
|
IlpDefaultObject(IlpClass ilpClass,
Object identifier,
boolean initializeAttributeValues)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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<IlpAttribute,Object> |
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<IlpAttribute,Object> 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.
|
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.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 IlpAttributeValueHolderpublic void setAttributeValue(IlpAttribute attribute, Object value)
Sets the value of an attribute of this object.
If the attribute does not exist, a default attribute with the given name will be created and added to the local attribute model, if possible.
Note: For the new value to be taken into account an object different from the initial object must be set.
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 IlpAttributeValueHolder@Deprecated public 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.@Deprecated 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)
Sets the value of an attribute of this object.
If the attribute does not exist, a default attribute with the given name is created and added to the local attribute model, if possible.
Note: For the new value to be taken into account, an object that is different from the initial one must be set.
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()
protected Map<IlpAttribute,Object> getLocalAttributeValues()
protected void setLocalAttributeValues(Map<IlpAttribute,Object> values)
protected void setObjectSupport(IlpObjectSupport s)
protected IlpObjectSupport getObjectSupport()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.