ilog.cpl.model
Class IlpDefaultClass

java.lang.Object
  extended by ilog.cpl.model.IlpAbstractClass
      extended by ilog.cpl.model.IlpDefaultClass
All Implemented Interfaces:
IlpAttributeGroup, IlpClass, IlpMutableAttributeGroup, IlpMutableClass
Direct Known Subclasses:
IlpBeansClass, IltObjectInfo

public class IlpDefaultClass
extends IlpAbstractClass
implements IlpMutableClass

Default business class implementation. Instances of IlpClass represent classes of the model. They provide access to the class hierarchy, and to the class attributes.

Since:
JTGO 3.0

Constructor Summary
IlpDefaultClass(String name)
          Creates an IlpClass with the given name.
IlpDefaultClass(String name, IlpClass superClass, List subClasses)
          Creates an IlpClass instance with all the needed configuration.
 
Method Summary
 void addAttribute(IlpAttribute attribute)
          Adds an attribute to the class.
 void addAttributeGroup(IlpAttributeGroup model)
          Adds the given model to be used by this one.
 void addAttributeGroupListener(AttributeGroupListener l)
          Adds a listener to model changes.
 void fireEvent(AttributeGroupEvent ev)
          Fires an event to the listeners.
 IlpAttribute getAttribute(String name)
          Returns an instance attribute of the class.
 Collection getAttributeGroups()
          Returns the list of all attribute groups being used by this one.
 Collection getAttributes()
          Returns the instance attributes of the class as a Collection.
 Collection getDeclaredAttributes()
          Returns the instance attributes of the class as a Collection.
 boolean hasAttribute(IlpAttribute attr)
          Returns whether the given attribute is part of the model.
 IlpObject newInstance(IlpClass ilpClass, Object identifier, boolean initializeAttributeValues)
          Creates an instance of the class.
 IlpObject newInstance(Object identifier, boolean initializeAttributeValues)
          Creates an instance of the class.
 void removeAttribute(IlpAttribute attribute)
          Removes an attribute from the class.
 void removeAttributeGroup(IlpAttributeGroup model)
          Removes the given model from the list of models.
 void removeAttributeGroupListener(AttributeGroupListener l)
          Removes the model listener.
 void setSuperClass(IlpClass superClass)
          Sets the superclass.
 String toString()
           
 
Methods inherited from class ilog.cpl.model.IlpAbstractClass
addSubClass, getName, getSubClasses, getSuperClass, isAssignableFrom, isSubClassOf, removeSubClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ilog.cpl.model.IlpMutableClass
addSubClass, removeSubClass
 
Methods inherited from interface ilog.cpl.model.IlpClass
getSubClasses, getSuperClass, isAssignableFrom, isSubClassOf
 
Methods inherited from interface ilog.cpl.model.IlpAttributeGroup
getName
 
Methods inherited from interface ilog.cpl.model.IlpAttributeGroup
getName
 

Constructor Detail

IlpDefaultClass

public IlpDefaultClass(String name)
Creates an IlpClass with the given name.

Parameters:
name - IlpClass name identifier.

IlpDefaultClass

public IlpDefaultClass(String name,
                       IlpClass superClass,
                       List subClasses)
Creates an IlpClass instance with all the needed configuration.

Parameters:
name - IlpClass name identifier.
superClass - List of all the IlpClass instances that are superclasses of this one.
subClasses - List of all the classes that inherit from this one. .
Method Detail

setSuperClass

public void setSuperClass(IlpClass superClass)
Sets the superclass.

This method sets the superclass information. It does not update the corresponding information in the parent class. To do this, use the method addSubClass.

Specified by:
setSuperClass in interface IlpMutableClass
Parameters:
superClass - Super class
See Also:
IlpAbstractClass.addSubClass(ilog.cpl.model.IlpClass)

addAttributeGroup

public void addAttributeGroup(IlpAttributeGroup model)
Adds the given model to be used by this one. The given attribute model is referenced by this class, and all the attributes are considered as attributes of the class too.

Specified by:
addAttributeGroup in interface IlpMutableClass

removeAttributeGroup

public void removeAttributeGroup(IlpAttributeGroup model)
Removes the given model from the list of models.

Specified by:
removeAttributeGroup in interface IlpMutableClass

getAttributeGroups

public Collection getAttributeGroups()
Returns the list of all attribute groups being used by this one.

Since:
JTGO 4.0
See Also:
addAttributeGroup(ilog.cpl.model.IlpAttributeGroup)

addAttribute

public void addAttribute(IlpAttribute attribute)
Adds an attribute to the class.

Specified by:
addAttribute in interface IlpMutableAttributeGroup
Parameters:
attribute - The attribute to be added.
See Also:
IlpAttribute.setAttributeGroup(ilog.cpl.model.IlpAttributeGroup)

removeAttribute

public void removeAttribute(IlpAttribute attribute)
Removes an attribute from the class.

Specified by:
removeAttribute in interface IlpMutableAttributeGroup
Parameters:
attribute - The attribute to be removed.
See Also:
IlpAttribute.setAttributeGroup(ilog.cpl.model.IlpAttributeGroup)

newInstance

public IlpObject newInstance(Object identifier,
                             boolean initializeAttributeValues)
Creates an instance of the class.

The new instance is created with the given identifier. If the argument initializeAttributeValues is set, the new instance is initialized with the default attribute values. Default attribute values are set in the attribute itself and are retrieved using IlpAttribute.getDefaultValue().

Specified by:
newInstance in interface IlpClass
Parameters:
identifier - Object identifier.
initializeAttributeValues -
Returns:
An object of this dynamic class, as an instance of the IlpObject interface. This default implementation returns an IlpDefaultObject instance.
See Also:
IlpObject, IlpAttribute.getDefaultValue()

newInstance

public IlpObject newInstance(IlpClass ilpClass,
                             Object identifier,
                             boolean initializeAttributeValues)
Creates an instance of the class.

The new instance is created with the given identifier. If the argument initializeAttributeValues is set, the new instance is initialized with the default attribute values. Default attribute values are set in the attribute itself and are retrieved using IlpAttribute.getDefaultValue().

Note: This method is supposed to be called by a subclass, the subclass passing itself as the first parameter.

Specified by:
newInstance in interface IlpClass
Parameters:
ilpClass - Business class.
identifier - Object identifier.
initializeAttributeValues -
Returns:
An object of this dynamic class, as an instance of the IlpObject interface. This default implementation returns an IlpDefaultObject instance.
See Also:
IlpObject, IlpAttribute.getDefaultValue()

getAttributes

public Collection getAttributes()
Returns the instance attributes of the class as a Collection.

This implementation returns a collection where the attributes are in the following order:

Specified by:
getAttributes in interface IlpAttributeGroup
Returns:
An unmodifiable collection containing IlpAttribute instances.

getDeclaredAttributes

public Collection getDeclaredAttributes()
Returns the instance attributes of the class as a Collection. This method returns only the attributes declared in this class in their insertion order.

Specified by:
getDeclaredAttributes in interface IlpAttributeGroup
Returns:
An unmodifiable collection containing IlpAttribute instances.

getAttribute

public IlpAttribute getAttribute(String name)
Returns an instance attribute of the class.

Specified by:
getAttribute in interface IlpAttributeGroup
Parameters:
name - The name of the instance attribute to be retrieved.
Returns:
The attribute corresponding to the specified name, or null if there is no matching attribute.

hasAttribute

public boolean hasAttribute(IlpAttribute attr)
Returns whether the given attribute is part of the model.

Specified by:
hasAttribute in interface IlpAttributeGroup

addAttributeGroupListener

public void addAttributeGroupListener(AttributeGroupListener l)
Adds a listener to model changes.

Specified by:
addAttributeGroupListener in interface IlpAttributeGroup

removeAttributeGroupListener

public void removeAttributeGroupListener(AttributeGroupListener l)
Removes the model listener.

Specified by:
removeAttributeGroupListener in interface IlpAttributeGroup

fireEvent

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

Specified by:
fireEvent in interface IlpAttributeGroup

toString

public String toString()
Overrides:
toString in class Object


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