com.ibm.rfid.epcis
Class Extension

java.lang.Object
  extended by com.ibm.rfid.epcis.Extension

public class Extension
extends java.lang.Object

The Extension class is a bean used to create extension elements to add custom content to the EPCIS event XML messages.

The name of the element to be created is passed in the constructor. Attributes for the element are passed as a HashMap of String names and String values.

The value of the element can either be a String, or another nested element(s). If nested (or child) elements are present, the String value will be ignored.

A code sample for constructing different forms of extensions is provided below:

                Extension batch = new Extension("batch");
                HashMap attribs = new HashMap();
                attribs.put("uid", "13213");
                attribs.put("cid", "32412");
                attribs.put("tid", "23123");
                batch.setAttributes(attribs);
                batch.setValue("12");
                
                Extension info = new Extension("info");
                Extension[] children = {batch};
                info.setChildren(children);
                
                Extension lot = new Extension("lot");
                lot.setValue("45");
                
                Extension ndc = new Extension("ndc");
                ndc.setValue("ndc:1245789.360");
                
                Extension[] exts = {info, lot, ndc};
                event.setExtensions(exts);
 


Field Summary
static java.lang.String COPYRIGHT
           
 
Constructor Summary
Extension(java.lang.String name)
          Constructor that will assign name
 
Method Summary
 java.util.HashMap getAttributes()
           
 Extension[] getChildren()
           
 java.lang.String getName()
           
 java.lang.String getValue()
           
 void setAttributes(java.util.HashMap attributes)
           
 void setChildren(Extension[] children)
           
 void setName(java.lang.String name)
           
 void setValue(java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Constructor Detail

Extension

public Extension(java.lang.String name)
Constructor that will assign name

Parameters:
name -
Method Detail

getAttributes

public java.util.HashMap getAttributes()
Returns:
Returns the attributes.

setAttributes

public void setAttributes(java.util.HashMap attributes)
Parameters:
attributes - The attributes to set.

getChildren

public Extension[] getChildren()
Returns:
Returns the children.

setChildren

public void setChildren(Extension[] children)
Parameters:
children - The children to set.

getName

public java.lang.String getName()
Returns:
Returns the name.

setName

public void setName(java.lang.String name)
Parameters:
name - The name to set.

getValue

public java.lang.String getValue()
Returns:
Returns the value.

setValue

public void setValue(java.lang.String value)
Parameters:
value - The value to set.


Copyright © 2005 - 2009 IBM Corp. All Rights Reserved.