com.sun.mdm.index.objects.epath
Class EPathAPI

java.lang.Object
  extended bycom.sun.mdm.index.objects.epath.EPathAPI

public class EPathAPI
extends java.lang.Object

The methods in this class are convenience methods for using the EPath object.


Constructor Summary
protected EPathAPI()
          prevent creation
 
Method Summary
static void addObjectValue(EPath e, ObjectNode context, java.lang.Object value)
          sets a field value, creates new objects along the path if it does not exist already.
static void addObjectValues(EPath e, int pos, ObjectNode context, java.util.ArrayList values)
          set a field on one or multiple object nodes with the provided values e.g.
static void getFieldList(EPath e, int pos, ObjectNode context, java.util.List values)
          Convenience method to return a list of field values denoted by the EPath object for Example, Person.Address[*].Line1 returns a collection of Line1 from each of the Addresss objects
static java.lang.Object getFieldValue(EPath e, ObjectNode context)
          uses the parsed op commands to traverse the ObjectNode and return the value specified by the EPath object.
static java.lang.Object getFieldValue(java.lang.String fqfn, ObjectNode context)
          Use an EPath string to select a single field object.
static java.lang.Object getFieldValueQB(EPath e, ObjectNode context)
          uses the parsed op commands to traverse the ObjectNode and return the value specified by the EPath object.
static java.lang.Object getFieldValueRec(EPath e, ObjectNode context, int pos)
           
static java.lang.String maskString(java.lang.Object str)
           
static void setFieldNull(java.lang.String fqfn, ObjectNode context, boolean forceNullable)
          uses the parsed op commands to traverse the ObjectNode and set the field specified by the Epath Object to null.
static void setFieldValue(EPath e, ObjectNode context, java.lang.Object value)
          uses the parsed op commands to traverse the ObjectNode and set the value specified by the Epath Object.
static void setFieldValue(EPath e, ObjectNode context, java.lang.Object value, boolean byReference)
          uses the parsed op commands to traverse the ObjectNode and set the value specified by the Epath Object.
static void setFieldValue(java.lang.String fqfn, ObjectNode context, java.lang.Object value)
          uses the EPath String to traverse the ObjectNode and set the value specified by the Epath Object.
static void setFieldValue(java.lang.String fqfn, ObjectNode context, java.lang.Object value, boolean byReference)
          uses the EPath String to traverse the ObjectNode and set the value specified by the Epath Object.
static java.lang.String unmaskString(java.lang.Object str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPathAPI

protected EPathAPI()
prevent creation

Method Detail

addObjectValue

public static void addObjectValue(EPath e,
                                  ObjectNode context,
                                  java.lang.Object value)
                           throws ObjectException,
                                  EPathException
sets a field value, creates new objects along the path if it does not exist already.

Parameters:
e - EPath Object
context - context of the operation
value - value
Throws:
ObjectException - ObjectNode access exception
EPathException - unsupported operation

addObjectValues

public static void addObjectValues(EPath e,
                                   int pos,
                                   ObjectNode context,
                                   java.util.ArrayList values)
                            throws ObjectException,
                                   EPathException
set a field on one or multiple object nodes with the provided values e.g. setting Address[*].state with [CA, AZ] will set the state field in the first and second Address object node to CA and AZ respectively. If the Address object nodes don't exist already, they are created. the EPath should contain one * if using this to set multiple values, it will start setting on the object nodes, from index 0 to number of values. creates new objects along the path if it does not exist already.

Parameters:
e - EPath object
pos - The current position, only used internally for recursion. Should be set to 0 in the initial call.
context - context of the operation
values - pre allocated list to hold values
Throws:
ObjectException - ObjectNode access exception
EPathException - unsupported operation

getFieldList

public static void getFieldList(EPath e,
                                int pos,
                                ObjectNode context,
                                java.util.List values)
                         throws ObjectException,
                                EPathException
Convenience method to return a list of field values denoted by the EPath object for Example, Person.Address[*].Line1 returns a collection of Line1 from each of the Addresss objects

Parameters:
e - the epath object
pos - The current position, only used internally for recursion. Should be set to 0 in the initial call.
context - context of the operation
values - pre allocated list to hold values
Throws:
ObjectException - ObjectNode access exception
EPathException - unsupported operation

getFieldValue

public static java.lang.Object getFieldValue(EPath e,
                                             ObjectNode context)
                                      throws ObjectException,
                                             EPathException
uses the parsed op commands to traverse the ObjectNode and return the value specified by the EPath object.

Parameters:
e - EPath object, contains parsed op commands and fqfn
context - ObjectNode, the node where the path starts
Returns:
an object representing the value of the specified field, or a collection if the qualified field name points to a list of child objects
Throws:
ObjectException - ObjectNode access exception
EPathException - EPath exception

getFieldValue

public static java.lang.Object getFieldValue(java.lang.String fqfn,
                                             ObjectNode context)
                                      throws ObjectException,
                                             EPathException
Use an EPath string to select a single field object. This method is significantly more expensive then passing in a pre-parsed EPath object

Parameters:
fqfn - EPath string
context - ObjectNode where the traversal begins
Returns:
return an object representing the value of the specified field, or a collection if the qualified field name points to a list of child objects
Throws:
ObjectException - object access exception
EPathException - EPath exception

getFieldValueQB

public static java.lang.Object getFieldValueQB(EPath e,
                                               ObjectNode context)
                                        throws ObjectException,
                                               EPathException
uses the parsed op commands to traverse the ObjectNode and return the value specified by the EPath object.

Parameters:
e - EPath object, contains parsed op commands and fqfn
context - ObjectNode, the node where the path starts
Returns:
an object representing the value of the specified field, or a collection if the qualified field name points to a list of child objects
Throws:
ObjectException - ObjectNode access exception
EPathException - EPath exception

getFieldValueRec

public static java.lang.Object getFieldValueRec(EPath e,
                                                ObjectNode context,
                                                int pos)
                                         throws ObjectException,
                                                EPathException
Throws:
ObjectException
EPathException

maskString

public static java.lang.String maskString(java.lang.Object str)

setFieldNull

public static void setFieldNull(java.lang.String fqfn,
                                ObjectNode context,
                                boolean forceNullable)
                         throws ObjectException,
                                EPathException
uses the parsed op commands to traverse the ObjectNode and set the field specified by the Epath Object to null.

Parameters:
fqfn - Fully qualified field name
context - ObjectNode where the EPath begins
forceNullable - Null field even if not set as nullable
Throws:
ObjectException - ObjectNode access exception
EPathException - EPath exception

setFieldValue

public static void setFieldValue(EPath e,
                                 ObjectNode context,
                                 java.lang.Object value)
                          throws ObjectException,
                                 EPathException
uses the parsed op commands to traverse the ObjectNode and set the value specified by the Epath Object.

Parameters:
e - EPath Object
context - ObjectNode where the EPath begins
value - value of the object to set. If the EPath is points to a collection, designated by [*], then the value must be of the Collection type. If the EPath points to a complete object, denoted by child[key].*, then the value must be of ObjectNode type
Throws:
ObjectException - ObjectNode access exception
EPathException - EPath exception

setFieldValue

public static void setFieldValue(EPath e,
                                 ObjectNode context,
                                 java.lang.Object value,
                                 boolean byReference)
                          throws ObjectException,
                                 EPathException
uses the parsed op commands to traverse the ObjectNode and set the value specified by the Epath Object.

Parameters:
e - EPath Object
context - ObjectNode where the EPath begins
value - value of the object to set. If the EPath is points to a collection, designated by [*], then the value must be of the Collection type. If the EPath points to a complete object, denoted by child[key].*, then the value must be of ObjectNode type
byReference - sets the field value by reference
Throws:
ObjectException - ObjectNode access exception
EPathException - EPath exception

setFieldValue

public static void setFieldValue(java.lang.String fqfn,
                                 ObjectNode context,
                                 java.lang.Object value)
                          throws ObjectException,
                                 EPathException
uses the EPath String to traverse the ObjectNode and set the value specified by the Epath Object. This method is significantly more expensive then passing in a pre-parsed EPath object

Parameters:
fqfn - EPath string
context - ObjectNode where the EPath begins
value - value of the object to set. If the EPath is points to a collection, designated by [*], then the value must be of the Collection type
Throws:
ObjectException - ObjectNode access exception
EPathException - EPath exception

setFieldValue

public static void setFieldValue(java.lang.String fqfn,
                                 ObjectNode context,
                                 java.lang.Object value,
                                 boolean byReference)
                          throws ObjectException,
                                 EPathException
uses the EPath String to traverse the ObjectNode and set the value specified by the Epath Object. This method is significantly more expensive then passing in a pre-parsed EPath object

Parameters:
fqfn - EPath string
context - ObjectNode where the EPath begins
value - value of the object to set. If the EPath is points to a collection, designated by [*], then the value must be of the Collection type
byReference - adds the value as a reference
Throws:
ObjectException - ObjectNode access exception
EPathException - EPath exception

unmaskString

public static java.lang.String unmaskString(java.lang.Object str)


Sun Microsystems, Inc.