org.deduced
Class ParameterFetcher

java.lang.Object
  extended by org.deduced.ParameterFetcher

public class ParameterFetcher
extends java.lang.Object

ParameterFetcher is a class used to breakdown a list of parameters while fetching inputs.

Author:
Steve McDuff

Field Summary
private  java.lang.Object previousRetVal
          the previous return value of the fetching action
private  java.lang.Object retVal
          the fetching return value
private  boolean searchFailed
          has the search failed
private  boolean splittingList
          flag indicating if we are splitting a list.
 
Constructor Summary
ParameterFetcher()
           
 
Method Summary
private static java.util.List<java.lang.Object> breakList(java.util.List<?> returnArray, PropertyCollection<?,?> propertyInstance)
          break a list of values to fetch a sub value based on a key in each element
private static void breakListElement(PropertyCollection<?,?> propertyInstance, java.util.List<java.lang.Object> newReturnArray, java.lang.Object element)
          break a List Element so that it may be consumed as a rule input
private static void fetchNextLevelOfValues(ParameterFetcher fetcher, PropertyCollection<?,?> propertyInstance)
          fetch Next Level Of Values
static java.lang.Object fetchParameterFromInstanceList(PropertyCollection<?,?> startPoint, boolean skipLast, java.util.List<?> instanceList)
          fetch all the values that match the defined input by starting at the specified start point and digging down the property tree following the instance list
static java.lang.Object fetchParameterFromInstanceReference(PropertyCollection<?,?> startPoint, PropertyCollection<?,?> instanceReference)
          fetch all the values that match the defined input by starting at the specified start point and digging down the property tree by following the instance reference
static java.lang.Object fetchParameterFromInstanceReference(PropertyCollection<?,?> startPoint, PropertyCollection<?,?> instanceReference, boolean skipLast)
          fetch all the values that match the defined input by starting at the specified start point and digging down the property tree by following the instance reference
static PropertyCollection<?,?> fetchStartCollection(PropertyCollection<?,?> ruleParent, PropertyCollection<?,?> instanceReference)
          fetch the collection that is used as a starting point to analyze an instance reference.
 java.lang.Object getPreviousRetVal()
           
 java.lang.Object getRetVal()
           
static boolean isAllPropertyValuesInstance(PropertyCollection<?,?> propertyInstance)
          test if the specified instance is the all property values wild card instance.
 boolean isSearchFailed()
           
 boolean isSplittingList()
           
 void setPreviousRetVal(java.lang.Object setPreviousRetVal)
           
 void setRetVal(java.lang.Object setRetVal)
           
 void setSearchFailed(boolean setSearchFailed)
           
 void setSplittingList(boolean setSplittingList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

retVal

private java.lang.Object retVal
the fetching return value


previousRetVal

private java.lang.Object previousRetVal
the previous return value of the fetching action


splittingList

private boolean splittingList
flag indicating if we are splitting a list. If true, then the retVal will be in the form of a java List.


searchFailed

private boolean searchFailed
has the search failed

Constructor Detail

ParameterFetcher

public ParameterFetcher()
Method Detail

setRetVal

public void setRetVal(java.lang.Object setRetVal)
Parameters:
setRetVal - the retVal to set

getRetVal

public java.lang.Object getRetVal()
Returns:
the retVal

setPreviousRetVal

public void setPreviousRetVal(java.lang.Object setPreviousRetVal)
Parameters:
setPreviousRetVal - the previousRetVal to set

getPreviousRetVal

public java.lang.Object getPreviousRetVal()
Returns:
the previousRetVal

setSplittingList

public void setSplittingList(boolean setSplittingList)
Parameters:
setSplittingList - the splittingList to set

isSplittingList

public boolean isSplittingList()
Returns:
the splittingList

setSearchFailed

public void setSearchFailed(boolean setSearchFailed)
Parameters:
setSearchFailed - the searchFailed to set

isSearchFailed

public boolean isSearchFailed()
Returns:
the searchFailed

fetchStartCollection

public static PropertyCollection<?,?> fetchStartCollection(PropertyCollection<?,?> ruleParent,
                                                           PropertyCollection<?,?> instanceReference)
fetch the collection that is used as a starting point to analyze an instance reference. There are 2 kinds of instance reference : those that start from the collection that owns the rule and those that start from a statically referenced collection.

Parameters:
ruleParent - the parent of the rule
instanceReference - the instance reference to use
Returns:
the instance reference starting point

fetchParameterFromInstanceReference

public static java.lang.Object fetchParameterFromInstanceReference(PropertyCollection<?,?> startPoint,
                                                                   PropertyCollection<?,?> instanceReference)
fetch all the values that match the defined input by starting at the specified start point and digging down the property tree by following the instance reference

Parameters:
startPoint - the property collection from which to start searching
instanceReference - the list of instances to follow
Returns:
the final value at the end of the key list

fetchParameterFromInstanceReference

public static java.lang.Object fetchParameterFromInstanceReference(PropertyCollection<?,?> startPoint,
                                                                   PropertyCollection<?,?> instanceReference,
                                                                   boolean skipLast)
fetch all the values that match the defined input by starting at the specified start point and digging down the property tree by following the instance reference

Parameters:
startPoint - the property collection from which to start searching
instanceReference - the list of instances to follow
skipLast - option to skip the last level of the key list. Useful to extract the list of collections that contain the last level of values.
Returns:
the final value at the end of the key list

fetchParameterFromInstanceList

public static java.lang.Object fetchParameterFromInstanceList(PropertyCollection<?,?> startPoint,
                                                              boolean skipLast,
                                                              java.util.List<?> instanceList)
fetch all the values that match the defined input by starting at the specified start point and digging down the property tree following the instance list

Parameters:
startPoint - the property collection from which to start searching
instanceList - the list of property instances to follow
skipLast - option to skip the last level of the key list. Useful to extract the list of collections that contain the last level of values.
Returns:
the final value at the end of the key list

fetchNextLevelOfValues

private static void fetchNextLevelOfValues(ParameterFetcher fetcher,
                                           PropertyCollection<?,?> propertyInstance)
fetch Next Level Of Values

Parameters:
fetcher - the current fetching results
propertyInstance - the current instance we are fetching

isAllPropertyValuesInstance

public static boolean isAllPropertyValuesInstance(PropertyCollection<?,?> propertyInstance)
test if the specified instance is the all property values wild card instance.

Parameters:
propertyInstance - the instance to verify.
Returns:
true if the specified instance is the all property values wild card instance.

breakList

private static java.util.List<java.lang.Object> breakList(java.util.List<?> returnArray,
                                                          PropertyCollection<?,?> propertyInstance)
break a list of values to fetch a sub value based on a key in each element

Parameters:
returnArray - the array of value to fetch the sub value
propertyInstance - the property instance of the sub value
Returns:
the list of sub objects

breakListElement

private static void breakListElement(PropertyCollection<?,?> propertyInstance,
                                     java.util.List<java.lang.Object> newReturnArray,
                                     java.lang.Object element)
break a List Element so that it may be consumed as a rule input

Parameters:
propertyInstance - the property instance we are breaking in the rule input
newReturnArray - the array of rule input results to fill
element - the current element to break.