ilog.cpl.model
Class IlpBeansObject

java.lang.Object
  extended by ilog.cpl.model.IlpBeansObject
All Implemented Interfaces:
IlpAttributeValueHolder, IlpObject, PropertyChangeListener, EventListener

public class IlpBeansObject
extends Object
implements IlpObject, PropertyChangeListener

This class implements the IlpObject interface to wrap a bean. A bean, that is, a JavaBeans instance, is an instance of a class that follows the JavaBeans conventions.

Instances of this class can be inserted in a data source. The IlpDefaultDataSource even provides a method IlpDefaultDataSource.addBean(Object, Object) that creates an IlpBeansObject instance from a Java object.

Since:
JTGO 3.0
See Also:
IlpBeansClass

Field Summary
 
Fields inherited from interface ilog.cpl.model.IlpAttributeValueHolder
VALUE_NOT_SET
 
Constructor Summary
IlpBeansObject(Object bean, IlpClass ilpClass, Object identifier)
          Creates an IlpObject instance to encapsulate the given bean.
 
Method Summary
 void addAttributeValueListener(AttributeValueListener l)
          Adds a listener to attribute value changes.
 void fireEvent(AttributeValueEvent ev)
          Fires the event to all 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 name)
          Returns the value of an attribute of this object.
 Object getBean()
          Returns the bean encapsulated by this instance.
 Object getIdentifier()
          Returns the identifier of the IlpObject.
 IlpBeansClass getIlpBeansClass()
          Returns the IlpClass of this object.
 IlpClass getIlpClass()
          Returns the IlpClass of this object.
 boolean hasAttributeValue(IlpAttribute a)
          Returns true if the requested attribute exists in the bean.
 void initializeDefaultValues()
          This method initializes the attribute values of the object with the default attribute values, if there are any.
 void propertyChange(PropertyChangeEvent evt)
          Property change listener notification.
 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 name, Object value)
          Sets the value of an attribute of this object.
 String toString()
          Returns the identifier as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlpBeansObject

public IlpBeansObject(Object bean,
                      IlpClass ilpClass,
                      Object identifier)
Creates an IlpObject instance to encapsulate the given bean.

Parameters:
bean - The bean wrapped by this instance.
ilpClass - The IlpClass that corresponds to the bean's Java class, or a sub-IlpClass of an IlpBeansClass.
identifier - The identifier of this instance.
Method Detail

getBean

public Object getBean()
Returns the bean encapsulated by this instance.


getIlpBeansClass

public IlpBeansClass getIlpBeansClass()
Returns the IlpClass of this object.


propertyChange

public void propertyChange(PropertyChangeEvent evt)
Property change listener notification. This method just translates the property change event to an attribute value event and fires this new event to all listeners.

Specified by:
propertyChange in interface PropertyChangeListener
Internal method or field: do not use!

getIdentifier

public Object getIdentifier()
Returns the identifier of the IlpObject. This identifier is an Object that can be used to uniquely identify and retrieve this IlpObject

Specified by:
getIdentifier in interface IlpObject
Returns:
The identifier of the IlpObject
See Also:
IlpTypeConverter

getIlpClass

public IlpClass getIlpClass()
Returns the IlpClass of this object.

Specified by:
getIlpClass in interface IlpObject
Returns:
The IlpClass of this object.

getAttributeGroup

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

Specified by:
getAttributeGroup in interface IlpAttributeValueHolder

getAttributeValue

public Object getAttributeValue(IlpAttribute attribute)
Retrieves the value of an attribute of this object. The reading of the attribute value in the bean is synchronized.

Specified by:
getAttributeValue in interface IlpAttributeValueHolder
Parameters:
attribute - The attribute whose value is to be retrieved.
Returns:
The value of the specified attribute.

hasAttributeValue

public boolean hasAttributeValue(IlpAttribute a)
Returns true if the requested attribute exists in the bean.

Specified by:
hasAttributeValue in interface IlpAttributeValueHolder

setAttributeValue

public void setAttributeValue(IlpAttribute attribute,
                              Object value)
Sets the value of an attribute of this object. The writing of the attribute value in the bean is synchronized.

Specified by:
setAttributeValue in interface IlpAttributeValueHolder
Parameters:
attribute - The attribute whose value is to be set.
value - The new value of the attribute.

getAttributeValue

public Object getAttributeValue(String name)
Returns the value of an attribute of this object.

Specified by:
getAttributeValue in interface IlpAttributeValueHolder
Parameters:
name - The name of the attribute whose value is to be retrieved.
Returns:
The value of the attribute.
Since:
JTGO 4.0

setAttributeValue

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 will be created and added to the local attribute model.

Specified by:
setAttributeValue in interface IlpAttributeValueHolder
Parameters:
name - The name of the attribute whose value is to be changed.
value - The new value of the attribute.
Since:
JTGO 4.0

addAttributeValueListener

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

Specified by:
addAttributeValueListener in interface IlpAttributeValueHolder

removeAttributeValueListener

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

Specified by:
removeAttributeValueListener in interface IlpAttributeValueHolder

fireEvent

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

Specified by:
fireEvent in interface IlpAttributeValueHolder

initializeDefaultValues

public void initializeDefaultValues()
This method initializes the attribute values of the object with the default attribute values, if there are any. In this particular implementation, it doesn't do anything.

Specified by:
initializeDefaultValues in interface IlpObject

toString

public String toString()
Returns the identifier as a string.

Overrides:
toString in class Object


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