<class> <name>Element</name> <superClass>ilog.tgo.model.IltNetworkElement</superClass> <attribute> <name>throughput</name> <javaClass>java.lang.Integer</javaClass> </attribute> </class>
throughput
).
IlpClass
Element
and the Java class
ilog.tgo.model.IltNetworkElement
.
Element
derives from two class hierarchies: the dynamic class hierarchy
and the Java class hierarchy.
IlpClass
Element
with XML or with the API, the created object will be an
instance of the Java class IltNetworkElement.
IlpClass elementClass = classManager.getClass("Element"); IlpObject element = elementClass.newInstance("element 1", true);
newInstance
is available in business classes to create new instances. This
method has two arguments:
initializeAttributeValues
: a flag which indicates whether the new instance has its
default attribute values initialized. It is important to
note that predefined business objects and their subclasses
always have their default attributes initialized when a new
instance is created. In this case, the second parameter is
ignored.
getIdentifier
,
getIlpClass
,
getAttributeValue
and
setAttributeValue
should not be overridden.
public MyClass (Object identifier) { super(identifier); }
public MyClass (IlpClass ilpclass, Object identifier) { super(ilpclass, identifier); }
getThroughput
/
setThroughput
) should call
getAttributeValue
and
setAttributeValue
with the appropriate parameters. These methods already provide
the mechanism to store the objects internally as well as
notification support.
THROUGHPUT
.
public class CustomNetworkElement extends IltNetworkElement { // Create the business class static IltObjectInfo metainfo = new IltObjectInfo(CustomNetworkElement.class, "CustomNetworkElement"); // Create the business attribute and register in the class public static final IlpAttribute THROUGHPUT = new IltAttribute("throughput", Integer.class, metainfo, new Integer(0)); // Register the new attribute in this business class static { metainfo.addAttribute(THROUGHPUT); } // Implement method GetIlpClass so that this class is automatically // recognized as a business class by the Class Manager service public static IltObjectInfo GetIlpClass() { return metainfo; } // Implement the class constructor public CustomNetworkElement (Object identifier) { super(identifier); } // Implement the class constructor public CustomNetworkElement (IlpClass clazz, Object identifier) { super(clazz, identifier); } public int getThroughput() { Object v = getAttributeValue(THROUGHPUT); if (v == ilog.cpl.model.IlpAttributeValueHolder.VALUE_NOT_SET) return 0; else return ((Integer)v).intValue(); } public void setThroughput(int throughput) { setAttributeValue(THROUGHPUT, new Integer(throughput)); } }