ilog.cpl.model
Interface IlpAttributeValueHolder

All Known Subinterfaces:
IlpEquipmentLink, IlpEquipmentNode, IlpMutableEquipmentLink, IlpMutableEquipmentNode, IlpMutableNetworkLink, IlpMutableNetworkNode, IlpMutableRepresentationLink, IlpMutableRepresentationNode, IlpNetworkLink, IlpNetworkNode, IlpObject, IlpRepresentationLink, IlpRepresentationNode, IlpRepresentationObject, IlpTableRow, IlpTreeNode
All Known Implementing Classes:
IlpAbstractRepresentationLink, IlpAbstractRepresentationNode, IlpAttributeValueHolderSupport, IlpBeansObject, IlpDefaultEquipmentLink, IlpDefaultEquipmentNode, IlpDefaultNetworkLink, IlpDefaultNetworkNode, IlpDefaultObject, IlpDefaultTableRow, IlpDefaultTreeNode, IlpObjectSupport, IlpRepresentationObjectSupport, IltAbstractLink, IltAlarm, IltBTS, IltBTSAntenna, IltCard, IltCardCarrier, IltCardItem, IltEmptySlot, IltGroup, IltLed, IltLinearGroup, IltLink, IltLinkBundle, IltLinkSet, IltNetworkElement, IltObject, IltOffPageConnector, IltPolyGroup, IltPort, IltRectGroup, IltShelf, IltShelfItem

public interface IlpAttributeValueHolder

This interface defines methods for classes that can store attributes and their values.

An IlpAttributeValueHolder can store one value for each attribute. A possible value is null. The value can be retrieved through the method getAttributeValue.

Note: When no value has been set for an attribute, getAttributeValue returns VALUE_NOT_SET.

Since:
JTGO 3.0

Field Summary
static Object VALUE_NOT_SET
          Value returned by getAttributeValue when no value has been set for a given attribute.
 
Method Summary
 void addAttributeValueListener(AttributeValueListener l)
          Adds a listener to attribute value changes.
 void fireEvent(AttributeValueEvent ev)
          Fires an event to the listeners.
 IlpAttributeGroup getAttributeGroup()
          Returns the model that defines which attributes are allowed in this instance.
 Object getAttributeValue(IlpAttribute attribute)
          Retrieves the value of an attribute of this object.
 Object getAttributeValue(String attributeName)
          Retrieves the value of an attribute of this object.
 boolean hasAttributeValue(IlpAttribute a)
          Returns true if: the requested attribute is part of the attribute group of this instance a value has been set for this attribute
 void removeAttributeValueListener(AttributeValueListener l)
          Removes the given listener from the attribute value change notifications.
 void setAttributeValue(IlpAttribute attribute, Object value)
          Sets the value of an attribute of this object.
 void setAttributeValue(String attributeName, Object value)
          Sets the value of an attribute of this object.
 

Field Detail

VALUE_NOT_SET

static final Object VALUE_NOT_SET
Value returned by getAttributeValue when no value has been set for a given attribute.

Method Detail

getAttributeGroup

IlpAttributeGroup getAttributeGroup()
Returns the model that defines which attributes are allowed in this instance.


getAttributeValue

Object getAttributeValue(IlpAttribute attribute)
Retrieves the value of an attribute of this object.

Parameters:
attribute - The attribute.
Returns:
The value of the attribute or VALUE_NOT_SET if no value has been set.

hasAttributeValue

boolean hasAttributeValue(IlpAttribute a)
Returns true if:


setAttributeValue

void setAttributeValue(IlpAttribute attribute,
                       Object value)
Sets the value of an attribute of this object. To remove the value of an attribute, you can pass VALUE_NOT_SET for the value argument.

Note: For the new value to be taken into account, set an object that is different from the initial object.

   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);
 

Parameters:
attribute - The attribute.
value - The new value of the attribute or VALUE_NOT_SET to remove the value of the attribute.
Throws:
IllegalArgumentException - if the attribute cannot have its value modified.

getAttributeValue

Object getAttributeValue(String attributeName)
Retrieves the value of an attribute of this object.

Parameters:
attributeName - The name of the attribute.
Returns:
The value of the attribute or VALUE_NOT_SET if no value has been set.
Since:
JTGO 4.0

setAttributeValue

void setAttributeValue(String attributeName,
                       Object value)
Sets the value of an attribute of this object. To remove the value of an attribute, you can pass VALUE_NOT_SET for the value argument.

Note: For the new value to be taken into account, set an object that is different from the initial object.

   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);
 

Parameters:
attributeName - The name of the attribute.
value - The new value of the attribute or VALUE_NOT_SET to remove the value of the attribute.
Throws:
IllegalArgumentException - if the attribute cannot have its value modified.
Since:
JTGO 4.0

addAttributeValueListener

void addAttributeValueListener(AttributeValueListener l)
Adds a listener to attribute value changes.


removeAttributeValueListener

void removeAttributeValueListener(AttributeValueListener l)
Removes the given listener from the attribute value change notifications.


fireEvent

void fireEvent(AttributeValueEvent ev)
Fires an event to the listeners.



Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.