public class PropertyResolver extends java.lang.Object implements Resolvable
resolve(String)
with "organisation.name" would first
call Resolvable.get(String)
with "organisation" on the base object.
If and only if the return value is again a Resolvable (representing the
organisation of the user) the resolving process would continue by calling
Resolvable.get(String)
with "name" on the organisation object. The
return value of this call would be the final value, since "name" is the last
part of the property path.resolve(String)
is done with "organisation.employees.email".
Resolving of "organisation" gives a single Resolvable
representing
the user's organisation. The property "employees" shall be a
Collection
of Resolvable
s representing all users of the
organisation. The resolving process would now continue by iterating over the
Collection
and get the property "email" for each Resolvable
.
So the final return value would be a Collection
of all email
addresses of all users of the base user's organisation.Modifier and Type | Class and Description |
---|---|
static class |
PropertyResolver.PropertyPathEntry
Inner class to return property path entries
|
Modifier and Type | Field and Description |
---|---|
protected Resolvable |
m_startObject |
Constructor and Description |
---|
PropertyResolver(Resolvable startObject)
create an instance of a PropertyResolver based on the given Resolvable
|
Modifier and Type | Method and Description |
---|---|
boolean |
canResolve()
Determine whether this resolver (the base object) can resolve right now
or not
|
java.lang.Object |
get(java.lang.String key)
Get a property from the base object.
|
java.lang.Object |
getProperty(java.lang.String key)
Get a property from the start object.
|
static java.lang.Object |
resolve(Resolvable startObject,
java.lang.String propertyPath)
Resolve the given property path to a value (which also might be a
Collection of values) or null, starting with the given startObject
|
static java.lang.Object |
resolve(Resolvable startObject,
java.lang.String propertyPath,
boolean failIfUnresolvablePath)
Resolve the given property path to a value (which also might be a
Collection of values) or null, starting with the given startObject.
|
java.lang.Object |
resolve(java.lang.String propertyPath)
Resolve the given property path to a value (which also might be a
Collection of values) or null.
|
java.lang.Object |
resolve(java.lang.String propertyPath,
boolean failIfUnresolvablePath)
Resolve the given property path to a value (which also might be a
Collection of values) or null.
|
static java.util.List |
resolvePath(Resolvable startObject,
java.lang.String propertyPath)
Resolve the given propertypath into a list of instances of
PropertyResolver.PropertyPathEntry , starting with the given Resolvable |
protected static java.util.List |
resolvePath(Resolvable startObject,
java.lang.String propertyPath,
boolean failIfUnresolvablePath,
java.lang.Class implementingClass,
boolean cleanResolvableStack,
java.util.Stack resolvableStack)
Resolve the given path into a list of objects.
|
java.util.List |
resolvePath(java.lang.String propertyPath)
Resolve the given propertypath into a list of instances of
PropertyResolver.PropertyPathEntry . |
protected Resolvable m_startObject
public PropertyResolver(Resolvable startObject)
startObject
- base resolvable objectpublic java.lang.Object resolve(java.lang.String propertyPath) throws UnknownPropertyException
propertyPath
- property pathUnknownPropertyException
- when the property path cannot be fully resolvedpublic static java.lang.Object resolve(Resolvable startObject, java.lang.String propertyPath) throws UnknownPropertyException
startObject
- start objectpropertyPath
- property pathUnknownPropertyException
- when the property path cannot be fully resolvedpublic java.util.List resolvePath(java.lang.String propertyPath) throws UnknownPropertyException
PropertyResolver.PropertyPathEntry
.propertyPath
- property path to resolveUnknownPropertyException
- when the property path cannot be fully resolvedpublic static java.util.List resolvePath(Resolvable startObject, java.lang.String propertyPath) throws UnknownPropertyException
PropertyResolver.PropertyPathEntry
, starting with the given ResolvablestartObject
- resolvable to start resolvingpropertyPath
- property path to resolveUnknownPropertyException
- when the property path cannot be fully resolvedprotected static java.util.List resolvePath(Resolvable startObject, java.lang.String propertyPath, boolean failIfUnresolvablePath, java.lang.Class implementingClass, boolean cleanResolvableStack, java.util.Stack resolvableStack) throws UnknownPropertyException
ResolverContextHandler.pop(Object)
for all objects that were put onto this stack (in the order they are popped() from this stack).startObject
- start objectpropertyPath
- property path to resolvefailIfUnresolvablePath
- true when the process shall fail if one
part of the path could not be resolvedimplementingClass
- interface or class all returned objects have to
implement, null for only returning the last objectcleanResolvableStack
- flag to mark whether the resolvable context
shall be cleanedresolvableStack
- stack for resolvable objectsUnknownPropertyException
- and logs a warningpublic java.lang.Object resolve(java.lang.String propertyPath, boolean failIfUnresolvablePath) throws UnknownPropertyException
propertyPath
- property pathfailIfUnresolvablePath
- true when the resolving shall fail with an
UnknownPropertyException, when a part of the property path (not
the last) could not be resolved. otherwise, the method would just
return null in such a caseUnknownPropertyException
- when the property path cannot be fully resolvedpublic static java.lang.Object resolve(Resolvable startObject, java.lang.String propertyPath, boolean failIfUnresolvablePath) throws UnknownPropertyException
startObject
- start objectpropertyPath
- property pathfailIfUnresolvablePath
- true when the resolving shall fail with an
UnknownPropertyException, when a part of the property path (not
the last) could not be resolved. otherwise, the method would just
return null in such a caseUnknownPropertyException
- when the property path cannot be fully resolvedpublic java.lang.Object get(java.lang.String key)
get
in interface Resolvable
key
- property keypublic boolean canResolve()
canResolve
in interface Resolvable
public java.lang.Object getProperty(java.lang.String key)
getProperty
in interface Resolvable
key
- property keyCopyright © 2019 Gentics Software. All Rights Reserved.