|
|||||||||
| Home >> All >> org >> scopemvc >> [ core overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.scopemvc.core
Class Selector

java.lang.Objectorg.scopemvc.core.Selector
- Direct Known Subclasses:
- IntIndexSelector, StringIndexSelector
- public abstract class Selector
- extends java.lang.Object
An identifier for model properties. Selectors are
created by the factory methods fromString(java.lang.String) 55
and fromInt(int) 55 . Properties can be identified
by a String name (eg the "address" property of
a Customer) or an integer index (eg element 1 of
a List).
Selectors can be assembled in a list to identify a property in a model
contained within another model. For example, the name
of the pet of a Person. This
Selector would be created by Selector.fromString("pet.name")
and applied to a Person model object. Similarly, the name of a
Person's first pet could be identified using
Selector.fromString("pets.0.name") assuming
that Person contains a List or array of Pets that contain a name property.
- Version:
- $Revision: 1.4 $ $Date: 2002/01/26 09:46:20 $
| Field Summary | |
static java.lang.String |
DELIMITER
Separator character between Selectors expressed as a String. |
private static org.apache.commons.logging.Log |
LOG
|
private Selector |
next
Link to next Selector in the list. |
| Constructor Summary | |
(package private) |
Selector()
Package private ctor for the factory. |
| Method Summary | |
static java.lang.String |
asString(Selector inSelector)
Flatten the Selector list to a String that could be passed into fromString(java.lang.String) 55 to recreate it. |
void |
chain(Selector inSelector)
Add a Selector on the end of this list. |
Selector |
deepClone()
Return a clone of the entire list of Selectors from this. |
boolean |
equals(java.lang.Object inObject)
A deep compare, following down the list of selectors. |
static IntIndexSelector |
fromInt(int inIndex)
Make a simple Selector to identify a property at an int index. |
static Selector |
fromString(java.lang.String inSelectorDescription)
Make a Selector to identify a property by its String name, or to create a Selector list that identifies a property by navigating a hierarchy of submodels. |
Selector |
getLast()
Get the last Selector in the list. |
abstract java.lang.String |
getName()
Used to serialise Selectors asString(org.scopemvc.core.Selector) 55
and for debug by toString() 55 . |
Selector |
getNext()
Get the next Selector in the list, if any. |
protected abstract Selector |
getShallowCopy()
Return a shallow copy of the head of this. |
void |
removeLast()
Remove the terminal Selector. |
protected void |
setNext(Selector inSelector)
Set the next Selector in the list. |
protected abstract boolean |
shallowEquals(Selector inSelector)
Compare the head Selector of this
against the head of another Selector list --
ie a shallow compare operation (not including the
chained selectors). |
boolean |
startsWith(Selector inSelector)
Does this Selector list start with the list passed in? |
java.lang.String |
toString()
For debug. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
LOG
private static final org.apache.commons.logging.Log LOG
next
private Selector next
- Link to next Selector in the list.
DELIMITER
public static java.lang.String DELIMITER
- Separator character between Selectors
expressed as a String.
- See Also:
fromString(java.lang.String)55 ,asString(org.scopemvc.core.Selector)55
| Constructor Detail |
Selector
Selector()
- Package private ctor for the factory. Application
code should use
fromString(java.lang.String)55 orfromInt(int)55 to create Selectors.
| Method Detail |
getNext
public final Selector getNext()
- Get the next Selector in the list, if any. For example,
Selector petNameSelector = Selector.fromString("pet.name"); return petNameSelector.getNext();returns a Selector that isequals()the following Selector:Selector.fromString("name");
setNext
protected final void setNext(Selector inSelector)
- Set the next Selector in the list.
chain
public final void chain(Selector inSelector)
Add a Selector on the end of this list.
For example:
Selector petSelector = Selector.fromString("pet"); Selector nameSelector = Selector.fromString("name"); petSelector.chain(nameSelector); return petSelector;returns a Selector that isequals()this one:Selector.fromString("pet.name");
getLast
public final Selector getLast()
- Get the last Selector in the list. For example,
Selector petNameSelector = Selector.fromString("pets.1.name"); return petNameSelector.getLast();returns a Selector that isequals()the following Selector:Selector.fromString("name");
removeLast
public final void removeLast()
- Remove the terminal Selector. Throws UnsupportedOperationException
if Selector has no chain.
startsWith
public final boolean startsWith(Selector inSelector)
Does this Selector list start with the list passed in?
For example, this returns
true:Selector petSelector = Selector.fromString("pet"); Selector petNameSelector = Selector.fromString("pet.name"); return (petNameSelector.startsWith(petSelector));but this returnsfalse:Selector nameSelector = Selector.fromString("name"); Selector petNameSelector = Selector.fromString("pet.name"); return (petNameSelector.startsWith(nameSelector));
shallowEquals
protected abstract boolean shallowEquals(Selector inSelector)
- Compare the head Selector of
thisagainst the head of another Selector list -- ie a shallow compare operation (not including the chained selectors).
equals
public final boolean equals(java.lang.Object inObject)
A deep compare, following down the list of selectors.
For example, this returns
true:Selector petSelector = Selector.fromString("pet"); Selector nameSelector = Selector.fromString("name"); Selector petNameSelector = Selector.fromString("pet.name"); petSelector.chain(nameSelector); return (petSelector.equals(petNameSelector));but this returnsfalse:Selector petSelector = Selector.fromString("pet"); Selector petNameSelector = Selector.fromString("pet.name"); return (petSelector.equals(petNameSelector));
deepClone
public final Selector deepClone()
- Return a clone of the entire list of
Selectors from
this.
getShallowCopy
protected abstract Selector getShallowCopy()
- Return a shallow copy of the head of
this.
getName
public abstract java.lang.String getName()
- Used to serialise Selectors
asString(org.scopemvc.core.Selector)55 and for debug bytoString()55 . ***** public access for test cases -- this is nasty.
toString
public final java.lang.String toString()
- For debug.
fromInt
public static IntIndexSelector fromInt(int inIndex)
- Make a simple Selector to identify a property at
an int index. eg this returns a Selector that identifies
the first element of a List:
return Selector.fromInt(0);
fromString
public static Selector fromString(java.lang.String inSelectorDescription)
- Make a Selector to identify a property by its String name,
or to create a Selector list that identifies a property by
navigating a hierarchy of submodels. For example:
-
Selector.fromString("name");will identify the name property of a Person when applied to a Person model object.
Selector.fromString("pet.0.name");will identify the name property of the first Pet of a Person when applied to a Person model object. -
asString
public static java.lang.String asString(Selector inSelector)
- Flatten the Selector list to a String that could
be passed into
fromString(java.lang.String)55 to recreate it.
|
|||||||||
| Home >> All >> org >> scopemvc >> [ core overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.scopemvc.core.Selector