|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deduced.DeducedUtilities
public final class DeducedUtilities
Utility methods to analyze property collections
Constructor Summary | |
---|---|
DeducedUtilities()
|
Method Summary | ||
---|---|---|
private static void |
addAllModelLayersInListToNameReferenceFinder(NameReferenceFinderImplementation nameReferenceFinder,
PropertyCollection<?,?> layerList)
parse a List of possible model layers And Add them all to a name Reference finder |
|
private static void |
addModelLayerCollectionListToNameReferenceFinder(PropertyCollection<?,?> modelLayer,
NameReferenceFinderImplementation nameReferenceFinder)
add Model Layer collection List To Name Reference Finder |
|
private static void |
addModelLayerDependentModelListToNameReferenceFinder(PropertyCollection<?,?> modelLayer,
NameReferenceFinderImplementation nameReferenceFinder)
add Model Layer Dependent Model List To Name Reference Finder |
|
private static void |
addModelLayerToNameReferenceFinderIfNameIsValid(PropertyCollection<?,?> modelLayer,
NameReferenceFinderImplementation nameReferenceFinder)
add Model Layer To Name Reference Finder only if it has a valid name |
|
private static void |
addPossibleModelLayerAndChildModelsToNameReferenceFinder(PropertyCollection<?,?> modelLayer,
NameReferenceFinderImplementation nameReferenceFinder)
add Model Layer and child models To Name Reference Finder |
|
private static void |
clearRemainingArraySpace(int clearStartIndex,
java.lang.Object[] arrayToClear)
Reset all array slots to null starting with clearStartIndex until the end of the array |
|
static
|
copyArrayToArray(T[] arrayToModify,
java.lang.Object[] sourceArray,
int size)
Utility method used to convert a source array to a destination array. |
|
static
|
copyCollectionToArray(T[] array,
java.util.Collection<V> collectionToConvert)
Utility method used to convert a collection to an array. |
|
static NameReferenceFinder |
createNamedReferenceFinderFromModelLayer(PropertyCollection<?,?> modelLayer)
create a Named Reference Finder From a Model Layer |
|
static void |
deleteQuietly(PropertyCollection<?,?> collectionToDelete)
delete a collection quietly |
|
static PropertyCollection<?,?> |
findChildByName(PropertyCollection<?,?> listToSearch,
java.lang.String nameToFind)
find a child property collection by name |
|
static
|
findChildPropertyCollection(PropertyCollection<K,X> collectionToSearch,
CK keyOnChildCollection,
V valueOnChildCollection)
Find a child collection from the collection to search that has a property matching the specified key and value |
|
static
|
findChildPropertyCollectionByValueInstance(PropertyCollection<K,X> collectionToSearch,
CK keyOnChildCollection,
V valueOnChildCollection)
Find a child collection from the collection to search that has a property matching the specified key and value with the identity == operator. |
|
static
|
findChildPropertyCollectionKey(PropertyCollection<K,X> collectionToSearch,
CK keyOnChildCollection,
V valueOnChildCollection)
Find a child collection from the collection to search that has a property matching the specified key and value |
|
static PropertyCollection<?,?> |
findPackageInSchema(PropertyCollection<?,?> schema,
java.lang.String[] packageNameList)
find a property package in a schema |
|
static boolean |
getBooleanProperty(PropertyCollection<?,?> collection,
java.lang.Object key)
Utility method to get a boolean property form a collection |
|
static java.lang.String |
getCollectionName(PropertyCollection<?,?> collection)
Fetch the name from a collection. |
|
static PropertyCollection<?,?> |
getCollectionProperty(PropertyCollection<?,?> collection,
java.lang.Object key)
Utility method to get a PropertyCollection property form a collection |
|
static PropertyCollection<?,?> |
getCollectionRoot(PropertyCollection<?,?> collection)
Fetch the root object that owns the whole object tree in which the specified collection is a part of. |
|
static int |
getDistanceBetweenTypes(PropertyCollection<?,?> objectType,
PropertyCollection<?,?> testType)
finds out how many inheritance level is required to reach type |
|
private static int |
getDistanceOnAbstractCollection(PropertyCollection<?,?> objectType,
PropertyCollection<?,?> testType,
int level)
internal recursive method to find the inheritance distance between two types. |
|
static double |
getDoubleProperty(PropertyCollection<?,?> collection,
java.lang.Object key)
Utility method to get a double property form a collection |
|
static float |
getFloatProperty(PropertyCollection<?,?> collection,
java.lang.Object key)
Utility method to get a float property form a collection |
|
protected static PropertyCollection<?,?> |
getInstanceType(PropertyCollection<?,?> collection)
Get the value of the instance : instance type |
|
static int |
getIntegerProperty(PropertyCollection<?,?> collection,
java.lang.Object key)
Utility method to get a integer property form a collection |
|
protected static java.lang.String |
getNamePropertyValue(PropertyCollection<?,?> namedCollection)
get Name Property Value |
|
static java.util.List<PropertyCollection<?,?>> |
getOrderedParentList(PropertyCollection<?,?> collection)
fetch the list of parents from the root node to the specified collection |
|
protected static PropertyCollection<?,?> |
getParentList(PropertyCollection<?,?> collection)
Get the value of the instance : parent list |
|
static PropertyCollection<?,?> |
getParentOfType(PropertyCollection<?,?> propertyCollection,
PropertyCollection<?,?> modelType)
fetch the parent of a collection that matches a certain type |
|
static PropertyCollection<?,?> |
getPropertyCollectionTypeType()
Utility method to get the basic PropertyCollectionType type |
|
protected static PropertyCollection<?,?> |
getPropertyInstanceList(PropertyCollection<?,?> collection)
Get the value of the instance : property instance list |
|
static PropertyCollection<?,?> |
getPropertyPackagePropertyPackageList(PropertyCollection<?,?> collection)
Utility method to get the list of sub package from a property package |
|
static java.lang.String |
getStringProperty(PropertyCollection<?,?> collection,
java.lang.Object key)
Utility method to get a String property form a collection |
|
static boolean |
isInstanceOf(PropertyCollection<?,?> objectType,
PropertyCollection<?,?> testType)
Check if the object type contains the test type in it's parent hierarchy |
|
protected static boolean |
isInstanceReference(PropertyCollection<?,?> instance)
return the is reference flag of a property instance. |
|
static boolean |
isInstanceTypeCollection(PropertyCollection<?,?> instance)
check to see if the instance type of a property instance is a property collection |
|
private static boolean |
isModelLayer(PropertyCollection<?,?> possibleModelLayer)
test if a collection is a model layer |
|
static boolean |
isParentCollection(PropertyCollection<?,?> possibleParent,
PropertyCollection<?,?> possibleChild)
check to see if a possible parent is a parent of the specified child collection |
|
static boolean |
isTypeCollection(PropertyCollection<?,?> type)
check if a type is used to define a property collection type |
|
static
|
removeListenerSilent(PropertyCollection<K,V> collection,
PropertyListener<? super K,? super V> listener)
remove a property Listener Silently to a collection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DeducedUtilities()
Method Detail |
---|
public static boolean isInstanceOf(PropertyCollection<?,?> objectType, PropertyCollection<?,?> testType)
objectType
- the object typetestType
- the type that might be a parent
public static int getDistanceBetweenTypes(PropertyCollection<?,?> objectType, PropertyCollection<?,?> testType)
objectType
- the lower typetestType
- the parent type
private static int getDistanceOnAbstractCollection(PropertyCollection<?,?> objectType, PropertyCollection<?,?> testType, int level)
objectType
- the object typetestType
- the type that might be in the parent list of the object
typelevel
- the current inheritance level depth
public static java.util.List<PropertyCollection<?,?>> getOrderedParentList(PropertyCollection<?,?> collection)
collection
- the last collection
public static PropertyCollection<?,?> getCollectionRoot(PropertyCollection<?,?> collection)
collection
- the collection in the tree
public static <T,V> T[] copyCollectionToArray(T[] array, java.util.Collection<V> collectionToConvert)
T
- the object type in the array to modify and returnV
- the type of value from the collection to convert to arrayarray
- the array that might be modified if the array is big enoughcollectionToConvert
- the collection that will be read and used to
fill the returned array
private static void clearRemainingArraySpace(int clearStartIndex, java.lang.Object[] arrayToClear)
clearStartIndex
- the start index that will be used to clear the
arrayarrayToClear
- the array to start clearingpublic static <T> T[] copyArrayToArray(T[] arrayToModify, java.lang.Object[] sourceArray, int size)
T
- the object type in the array to modify and returnarrayToModify
- the array that might be modified if the array is big
enoughsourceArray
- the array that will be read and used to fill the
returned arraysize
- size of the source array to copy.
public static java.lang.String getCollectionName(PropertyCollection<?,?> collection)
collection
- the collection from which to fetch the name
public static PropertyCollection<?,?> getPropertyPackagePropertyPackageList(PropertyCollection<?,?> collection)
collection
- the property package
public static boolean getBooleanProperty(PropertyCollection<?,?> collection, java.lang.Object key)
collection
- the collection from which to fetch the valuekey
- the property key
public static int getIntegerProperty(PropertyCollection<?,?> collection, java.lang.Object key)
collection
- the collection from which to fetch the valuekey
- the property key
public static float getFloatProperty(PropertyCollection<?,?> collection, java.lang.Object key)
collection
- the collection from which to fetch the valuekey
- the property key
public static double getDoubleProperty(PropertyCollection<?,?> collection, java.lang.Object key)
collection
- the collection from which to fetch the valuekey
- the property key
public static java.lang.String getStringProperty(PropertyCollection<?,?> collection, java.lang.Object key)
collection
- the collection from which to fetch the valuekey
- the property key
public static PropertyCollection<?,?> getCollectionProperty(PropertyCollection<?,?> collection, java.lang.Object key)
collection
- the collection from which to fetch the valuekey
- the property key
public static PropertyCollection<?,?> getPropertyCollectionTypeType()
public static boolean isInstanceTypeCollection(PropertyCollection<?,?> instance)
instance
- the property instance
public static boolean isTypeCollection(PropertyCollection<?,?> type)
type
- the type to verify
public static PropertyCollection<?,?> findPackageInSchema(PropertyCollection<?,?> schema, java.lang.String[] packageNameList)
schema
- the schema to search frompackageNameList
- the list of package names
public static PropertyCollection<?,?> findChildByName(PropertyCollection<?,?> listToSearch, java.lang.String nameToFind)
listToSearch
- the list of named property collectionsnameToFind
- the name to find
public static PropertyCollection<?,?> getParentOfType(PropertyCollection<?,?> propertyCollection, PropertyCollection<?,?> modelType)
propertyCollection
- the collection to search frommodelType
- the type to look for
public static <K,V,CK,X extends PropertyCollection<CK,V>> K findChildPropertyCollectionKey(PropertyCollection<K,X> collectionToSearch, CK keyOnChildCollection, V valueOnChildCollection)
K
- the key type on the collection to searchV
- the value type to search for on the child collectionsCK
- the key type on the child collectionsX
- the type of child collections on the collection to searchcollectionToSearch
- the collection to searchkeyOnChildCollection
- the child property keyvalueOnChildCollection
- the value of the child property
public static <K,V,CK,X extends PropertyCollection<CK,? super V>> X findChildPropertyCollection(PropertyCollection<K,X> collectionToSearch, CK keyOnChildCollection, V valueOnChildCollection)
K
- the key type on the collection to searchV
- the value type to search for on the child collectionsCK
- the key type on the child collectionsX
- the type of child collections on the collection to searchcollectionToSearch
- the collection to searchkeyOnChildCollection
- they key of the child propertyvalueOnChildCollection
- the value of the child property
public static <K,V,CK,X extends PropertyCollection<CK,? super V>> X findChildPropertyCollectionByValueInstance(PropertyCollection<K,X> collectionToSearch, CK keyOnChildCollection, V valueOnChildCollection)
K
- the key type on the collection to searchV
- the value type to search for on the child collectionsCK
- the key type on the child collectionsX
- the type of child collections on the collection to searchcollectionToSearch
- the collection to searchkeyOnChildCollection
- they key of the child propertyvalueOnChildCollection
- the value of the child property
public static boolean isParentCollection(PropertyCollection<?,?> possibleParent, PropertyCollection<?,?> possibleChild)
possibleParent
- the possible parentpossibleChild
- the possible child collection
public static <K,V> void removeListenerSilent(PropertyCollection<K,V> collection, PropertyListener<? super K,? super V> listener)
K
- the collection key typeV
- the collection value typelistener
- the listener to removecollection
- the collection from which to remove the listenerpublic static void deleteQuietly(PropertyCollection<?,?> collectionToDelete)
collectionToDelete
- the collection to deletepublic static NameReferenceFinder createNamedReferenceFinderFromModelLayer(PropertyCollection<?,?> modelLayer) throws java.lang.IllegalArgumentException
modelLayer
- the model layer
java.lang.IllegalArgumentException
- if the model isn't an instance of
deduced model layer.private static void addPossibleModelLayerAndChildModelsToNameReferenceFinder(PropertyCollection<?,?> modelLayer, NameReferenceFinderImplementation nameReferenceFinder)
modelLayer
- the model layer to addnameReferenceFinder
- the name reference finder in which to add the
model and it's child models.private static boolean isModelLayer(PropertyCollection<?,?> possibleModelLayer)
possibleModelLayer
- the possible model layer
private static void addModelLayerDependentModelListToNameReferenceFinder(PropertyCollection<?,?> modelLayer, NameReferenceFinderImplementation nameReferenceFinder)
modelLayer
- the model layer to usenameReferenceFinder
- the name reference finder to useprivate static void addModelLayerCollectionListToNameReferenceFinder(PropertyCollection<?,?> modelLayer, NameReferenceFinderImplementation nameReferenceFinder)
modelLayer
- the model layer to usenameReferenceFinder
- the name reference finder to useprivate static void addModelLayerToNameReferenceFinderIfNameIsValid(PropertyCollection<?,?> modelLayer, NameReferenceFinderImplementation nameReferenceFinder)
modelLayer
- the model layer to addnameReferenceFinder
- the name reference finder in which to register
the model layerprotected static java.lang.String getNamePropertyValue(PropertyCollection<?,?> namedCollection)
This method is used to remove dependencies from the deduced package to the deduced.implementation package. The normal method to use is the one found in the generated implementation.
namedCollection
- the named collection
private static void addAllModelLayersInListToNameReferenceFinder(NameReferenceFinderImplementation nameReferenceFinder, PropertyCollection<?,?> layerList)
nameReferenceFinder
- the name reference finder to filllayerList
- the list of layersprotected static boolean isInstanceReference(PropertyCollection<?,?> instance)
This method is used to remove dependencies from the deduced package to the deduced.implementation package. The normal method to use is the one found in the generated implementation.
instance
- the instance from which to fetch the reference flag.
protected static PropertyCollection<?,?> getParentList(PropertyCollection<?,?> collection)
This method is used to remove dependencies from the deduced package to the deduced.implementation package. The normal method to use is the one found in the generated implementation.
collection
- new collection from which to fetch the value
protected static PropertyCollection<?,?> getPropertyInstanceList(PropertyCollection<?,?> collection)
This method is used to remove dependencies from the deduced package to the deduced.implementation package. The normal method to use is the one found in the generated implementation.
collection
- new collection from which to fetch the value
protected static PropertyCollection<?,?> getInstanceType(PropertyCollection<?,?> collection)
This method is used to remove dependencies from the deduced package to the deduced.implementation package. The normal method to use is the one found in the generated implementation.
collection
- new collection from which to fetch the value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |