Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.sdo.helper
Class XPathEngine

java.lang.Object
  extended by org.eclipse.persistence.sdo.helper.XPathEngine


public class XPathEngine
extends java.lang.Object

Purpose: Perform operations based on SDO XPath against DataObjects.


Field Summary
protected static XPathEngine defaultXPathEngine
           
private static int ISSET
           
private static int SET
           
private static int UNSET
           

 

Constructor Summary
private XPathEngine()
           

 

Method Summary
private  int acquireNumberAtDot(java.lang.String frag, int dotIndex)
          Extract the position (index) from a dot fragment of path
private  int acquireNumberInBrackets(java.lang.String frag, int openBracketIndex, int closeBracketIndex)
          Extract position (index) from a bracket fragment of path
 java.lang.Object convertObjectToValueByPath(java.lang.String path, java.lang.Class cls, DataObject caller)
          access the wanted values through path and convert it into required java class.
 java.lang.Object get(java.lang.String path, DataObject caller)
          When accessing values corresponding to properties of DataObject by path base accessors, the accessed getters will pass informations to this method to process information and acquire wanted values.
private  DataObject getDataObjectFromQuery(java.lang.String frag, int openBracketIndex, int closeBracketIndex, int equalsignIndex, DataObject caller, java.lang.String callerProperty)
          Access the DataObject value by using the fragment containing query informations.
static XPathEngine getInstance()
           
private  java.lang.String getLocalName(java.lang.String qualifiedName)
           
private  int getNumberInFrag(java.lang.String frag, int indexOfDot, int indexOfOpenBracket, int indexOfCloseBracket)
          Judge if positional path belongs to bracket case or dot case, then perform different actions.
private  java.lang.Object getObjectByFragment(java.lang.String propertyName, int position, DataObject caller)
          Check if position exists, then either acquire value through position or directly.
private  java.lang.String getPropertyNameInFrag(java.lang.String frag, int position, int indexOfDot, int indexOfOpenBracket)
          Extract the property name hidden in a fragment of path
private  java.lang.Object getValueForFragment(java.lang.String frag, DataObject caller)
          Process the passed in fragment, extract the position information if available, acquire the property name hidden in this fragment and check if this fragment is actually query base.
private  int isQueryPath(java.lang.String frag, int openBracketIndex, int closeBracketIndex)
          check if information in brackets is qury or not.
private  boolean isSet(Property lastProperty, DataObject lastDataObject)
          Method that returns whether a property is set.
 boolean isSet(java.lang.String path, DataObject caller)
          Handle queries about setting status of a property through path base access.
private  boolean processPath(java.lang.String path, java.lang.Object value, DataObject caller, boolean convertValue, int _case)
          extract wanted fragment from the string representation of path and pass processed result to method setIsSetUnSet for further operation.
private  void set(Property lastProperty, DataObject lastDataObject, int numInLastProperty, java.lang.Object value, boolean convertValue)
          Set a property's value.
 void set(java.lang.String path, java.lang.Object value, DataObject caller, boolean convertValue)
          Set a property's value through the path base access.
private  boolean setIsSetUnSet(java.lang.String frag, java.lang.String path, DataObject caller, java.lang.Object value, int lastSlashIndex, boolean convertValue, int _case)
          According to the requirement, correspondingly perform isset, unset or set function.
private  void unSet(Property lastProperty, DataObject lastDataObject, int numInLastProperty)
          Method that unset a certain property's value.
 void unset(java.lang.String path, DataObject caller)
          Unset the value of a property through the path base access.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

SET

private static final int SET
See Also:
Constant Field Values

ISSET

private static final int ISSET
See Also:
Constant Field Values

UNSET

private static final int UNSET
See Also:
Constant Field Values

defaultXPathEngine

protected static XPathEngine defaultXPathEngine

Constructor Detail

XPathEngine

private XPathEngine()

Method Detail

getInstance

public static XPathEngine getInstance()

isSet

public boolean isSet(java.lang.String path,
                     DataObject caller)
Handle queries about setting status of a property through path base access.
Parameters:
path - the String representation of path based access
caller - the DataObject that pass path information in
Returns:
true if queried property is set, otherwise false

unset

public void unset(java.lang.String path,
                  DataObject caller)
Unset the value of a property through the path base access.
Parameters:
path - the String representation of path based access
caller - the DataObject that pass path information in

set

public void set(java.lang.String path,
                java.lang.Object value,
                DataObject caller,
                boolean convertValue)
Set a property's value through the path base access.
Parameters:
path - the String representation of path based access
value - the value to be set as the target property's value
caller - the DataObject that pass path information in
convertValue - boolean used for set if we should convert the value

get

public java.lang.Object get(java.lang.String path,
                            DataObject caller)
When accessing values corresponding to properties of DataObject by path base accessors, the accessed getters will pass informations to this method to process information and acquire wanted values.
Parameters:
path - the String representation of path based access
caller - the DataObject that pass path information in
Returns:
the value gotten by accessing through path

processPath

private boolean processPath(java.lang.String path,
                            java.lang.Object value,
                            DataObject caller,
                            boolean convertValue,
                            int _case)
extract wanted fragment from the string representation of path and pass processed result to method setIsSetUnSet for further operation.
Parameters:
path - the String representation of path based access
value - the value to be set as the target property's value
caller - the DataObject that pass path information in
convertValue - boolean used for set if we should convert the value
_case - an int value indicating what kind of operation to use: set, isset or unset.
Returns:
true if operation is isset and property's value is set, otherwise false.

setIsSetUnSet

private boolean setIsSetUnSet(java.lang.String frag,
                              java.lang.String path,
                              DataObject caller,
                              java.lang.Object value,
                              int lastSlashIndex,
                              boolean convertValue,
                              int _case)
According to the requirement, correspondingly perform isset, unset or set function.
Parameters:
frag - one string fragment in the path
path - the String representation of path based access
caller - the DataObject that pass path information in
value - the value to be set as the target property's value
lastSlashIndex - the last index of '/' in the path string
convertValue - boolean used for set if we should convert the value
_case - an int value indicating what kind of operation to use: set, isset or unset.
Returns:
true if operation is isset and property's value is set, otherwise false.

isSet

private boolean isSet(Property lastProperty,
                      DataObject lastDataObject)
Method that returns whether a property is set.
Parameters:
lastProperty - the property to queries.
lastDataObject - the DataObject, owner of the queried property
Returns:
return true, if property's value is set, otherwise false.

unSet

private void unSet(Property lastProperty,
                   DataObject lastDataObject,
                   int numInLastProperty)
Method that unset a certain property's value.
Parameters:
lastProperty - the property to queries.
lastDataObject - the DataObject, owner of the queried property

set

private void set(Property lastProperty,
                 DataObject lastDataObject,
                 int numInLastProperty,
                 java.lang.Object value,
                 boolean convertValue)
Set a property's value.
Parameters:
lastProperty - the property to queries.
lastDataObject - the DataObject, owner of the queried property
numInLastProperty - the index number in the value list of the above property
value - the value to be set as the target property's value
convertValue - boolean used for set if we should convert the value

getLocalName

private java.lang.String getLocalName(java.lang.String qualifiedName)

getValueForFragment

private java.lang.Object getValueForFragment(java.lang.String frag,
                                             DataObject caller)
Process the passed in fragment, extract the position information if available, acquire the property name hidden in this fragment and check if this fragment is actually query base. Then perform corresponding actions to access values.
Parameters:
frag - one string fragment in the path
caller - a DataObject that originally took the path information
Returns:
values to be accessed

getPropertyNameInFrag

private java.lang.String getPropertyNameInFrag(java.lang.String frag,
                                               int position,
                                               int indexOfDot,
                                               int indexOfOpenBracket)
Extract the property name hidden in a fragment of path
Parameters:
frag - one string fragment in the path
position - the index of values to be accessed
indexOfDot - the index of . in the fragment
indexOfOpenBracket - the indexof [ in the fragment
Returns:
the property name hidden in this fragment

getNumberInFrag

private int getNumberInFrag(java.lang.String frag,
                            int indexOfDot,
                            int indexOfOpenBracket,
                            int indexOfCloseBracket)
Judge if positional path belongs to bracket case or dot case, then perform different actions.
Parameters:
frag - one string fragment in the path
indexOfDot - the index of . in the fragment
indexOfOpenBracket - the index of [ in the fragment
indexOfCloseBracket - the index of ] in the fragment
Returns:
the position hidden in fragment

isQueryPath

private int isQueryPath(java.lang.String frag,
                        int openBracketIndex,
                        int closeBracketIndex)
check if information in brackets is qury or not.
Parameters:
frag - a fragment in path
openBracketIndex - index of open bracket in fragment
closeBracketIndex - index of close bracket in fragment
Returns:

getDataObjectFromQuery

private DataObject getDataObjectFromQuery(java.lang.String frag,
                                          int openBracketIndex,
                                          int closeBracketIndex,
                                          int equalsignIndex,
                                          DataObject caller,
                                          java.lang.String callerProperty)
Access the DataObject value by using the fragment containing query informations.
Parameters:
frag - one string fragment in the path
openBracketIndex - the index of open bracket in a fragment
closeBracketIndex - the index of close bracket in a fragment
equalsignIndex - the index of equalsign in string fragment quoted by brackets
caller - the DataObject that passes the path information in
callerProperty - the name of the property
Returns:
the DataObject as value of the property having name as the above callerProperty

getObjectByFragment

private java.lang.Object getObjectByFragment(java.lang.String propertyName,
                                             int position,
                                             DataObject caller)
Check if position exists, then either acquire value through position or directly.
Parameters:
propertyName - the name of property of the caller
position - the index of values to be accessed
caller - the DataObject containing property with the passed in property name
Returns:
the values to be accessed

acquireNumberInBrackets

private int acquireNumberInBrackets(java.lang.String frag,
                                    int openBracketIndex,
                                    int closeBracketIndex)
Extract position (index) from a bracket fragment of path
Parameters:
frag - a fragment of path
openBracketIndex - the index of [ in path
closeBracketIndex - the index of ] in path
Returns:
the index hidden in fragment

acquireNumberAtDot

private int acquireNumberAtDot(java.lang.String frag,
                               int dotIndex)
Extract the position (index) from a dot fragment of path
Parameters:
frag - a fragment of path
dotIndex - the index of . in path
Returns:
the index hidden in the fragment

convertObjectToValueByPath

public java.lang.Object convertObjectToValueByPath(java.lang.String path,
                                                   java.lang.Class cls,
                                                   DataObject caller)
                                            throws java.lang.ClassCastException
access the wanted values through path and convert it into required java class. If conversion is not supported, exception is thrown.
Parameters:
path - string representation of accessing path
cls - the java class that accessed value is to be converted to
caller - the DataObject that pass the path in
Returns:
values to be accessed
Throws:
java.lang.ClassCastException

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.