ilog.cpl.model
Class IlpReferenceAttribute

java.lang.Object
  extended by ilog.cpl.model.IlpDefaultAttribute
      extended by ilog.cpl.model.IlpReferenceAttribute
All Implemented Interfaces:
IlpAttribute, IlpAttributeValueProvider
Direct Known Subclasses:
IlpObjectReferenceAttribute

public class IlpReferenceAttribute
extends IlpDefaultAttribute
implements IlpAttributeValueProvider

This class defines an attribute that refers to another attribute in the same attribute holder. It can be used to implement a type conversion, to allow different representations for the same attribute, or to refer to attributes in another holder.

Since:
JTGO 3.0

Constructor Summary
IlpReferenceAttribute(String name, Class valueClass, IlpAttribute referenceAttribute)
          Creates a new attribute with the given name and class.
IlpReferenceAttribute(String name, IlpAttribute referenceAttribute)
          Creates a new attribute with the given name.
 
Method Summary
 Object getDefaultValue()
          Returns the default value for this attribute.
 IlpAttribute getReferenceAttribute()
          Returns the reference attribute.
 Object getValue(IlpAttributeValueHolder h)
          Returns the value of the attribute in the given holder.
 boolean isDependentOn(IlpAttribute a)
          Indicates whether this attribute depends on the given attribute to calculate its value.
 boolean isTransient()
          Indicates whether this attribute is persistent or not.
 void setValueClass(Class c)
          Sets the attribute value class.
 
Methods inherited from class ilog.cpl.model.IlpDefaultAttribute
getAttributeGroup, getName, getValueClass, setAttributeGroup, setDefaultValue, setName, setTransient, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlpReferenceAttribute

public IlpReferenceAttribute(String name,
                             IlpAttribute referenceAttribute)
Creates a new attribute with the given name. The value of the created attribute is provided by the value of the reference attribute. The attribute class is given by the reference attribute class.

Parameters:
name - The name of the new attribute.
referenceAttribute - The attribute that is being referenced by this one.

IlpReferenceAttribute

public IlpReferenceAttribute(String name,
                             Class valueClass,
                             IlpAttribute referenceAttribute)
Creates a new attribute with the given name and class. The value of the created attribute is provided by the reference attribute. This attribute value class may differ from the reference attribute value class; in this case, a conversion may be applied when the value of this attribute is retrieved.

Parameters:
name - The name of the new attribute.
valueClass - The attribute value class.
referenceAttribute - The attribute that is being referenced by this one.
Method Detail

getReferenceAttribute

public IlpAttribute getReferenceAttribute()
Returns the reference attribute.


setValueClass

public void setValueClass(Class c)
Sets the attribute value class.

Overrides:
setValueClass in class IlpDefaultAttribute
Parameters:
c - Value class

getDefaultValue

public Object getDefaultValue()
Returns the default value for this attribute.

Specified by:
getDefaultValue in interface IlpAttribute
Overrides:
getDefaultValue in class IlpDefaultAttribute
See Also:
IlpDefaultObject.initializeDefaultValues(), IlpDefaultObject.IlpDefaultObject(IlpClass, Object, boolean)

getValue

public Object getValue(IlpAttributeValueHolder h)
Returns the value of the attribute in the given holder.

Specified by:
getValue in interface IlpAttributeValueProvider

isDependentOn

public boolean isDependentOn(IlpAttribute a)
Indicates whether this attribute depends on the given attribute to calculate its value.

Specified by:
isDependentOn in interface IlpAttributeValueProvider

isTransient

public boolean isTransient()
Indicates whether this attribute is persistent or not.

Specified by:
isTransient in interface IlpAttribute
Overrides:
isTransient in class IlpDefaultAttribute
Returns:
true.


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