|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.morph.lang.languages.BaseLanguage net.sf.morph.lang.languages.SimpleLanguage
public class SimpleLanguage
A simple language that is similar to the languages used by the JSTL EL, the
Spring framework, Jakarta Commons BeanUtils, and Struts. Any "simple"
expression in any of these languages should be recognized by this language.
An example of a simple expression is myBean.myProperty
. An
example of a "non-simple" expression is
myBean.myProperty + myOtherBean.myOtherProperty
To be more precise, this language treats numbers as indexes into array-like
objects and treats other alphanumeric identifiers as property names of
bean-like objects. The following characters are all considered delimiters
with no particularly special meaning: []()."'
. Thus, all
of the expressions in the table below have the same value in this language.
Language | Expression |
---|---|
JSTL EL , Morph's simple language | myBean.myMap["mapProperty"].myArray[0] |
Spring , Morph's simple language | myBean.myMap[mapProperty].myArray[0] |
Jakarta Commons BeanUtils , Struts , Morph's simple language | myBean.myMap(mapProperty).myArray[0] |
Morph's simple language | myBean.myMap.mapProperty.myArray[0] |
Morph's simple language | myBean.myMap.mapProperty.myArray.0 |
Morph's simple language | myBean"myMap"'''['.']'('.')mapProperty""""myArray[]0.... |
A simple language that will work for most use cases, but has the limitation
that bean property names cannot be numbers. Numbers like 123 are always
considered indices into an indexed object. For example, 123
is an invalid bean property name in this language, but 12Monkies
and fridayThe13th
are valid property names.
Constructor Summary | |
---|---|
SimpleLanguage()
|
Method Summary | |
---|---|
ExpressionParser |
getExpressionParser()
Get the expression parser. |
protected java.lang.Object |
getImpl(java.lang.Object target,
java.lang.String expression)
Implement get(target, expression) . |
BeanReflector |
getReflector()
Get the reflector. |
protected java.lang.Class |
getTypeImpl(java.lang.Object target,
java.lang.String expression)
Implement getType(target, expression) . |
protected boolean |
isPropertyImpl(java.lang.String expression)
Implement isProperty(expression) . |
void |
setExpressionParser(ExpressionParser expressionParser)
Set the expression parser. |
protected void |
setImpl(java.lang.Object target,
java.lang.String expression,
java.lang.Object value)
Implement set(target, expression, value) . |
void |
setReflector(BeanReflector reflector)
Set the reflector. |
Methods inherited from class net.sf.morph.lang.languages.BaseLanguage |
---|
get, get, get, get, getConverter, getLanguageName, getType, isProperty, set, set, setConverter, setLanguageName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SimpleLanguage()
Method Detail |
---|
protected boolean isPropertyImpl(java.lang.String expression) throws java.lang.Exception
isProperty(expression)
.
isPropertyImpl
in class BaseLanguage
java.lang.Exception
protected java.lang.Class getTypeImpl(java.lang.Object target, java.lang.String expression) throws java.lang.Exception
getType(target, expression)
.
getTypeImpl
in class BaseLanguage
target
- beanexpression
- to read
java.lang.Exception
protected java.lang.Object getImpl(java.lang.Object target, java.lang.String expression) throws java.lang.Exception
get(target, expression)
.
getImpl
in class BaseLanguage
target
- beanexpression
- to get
java.lang.Exception
protected void setImpl(java.lang.Object target, java.lang.String expression, java.lang.Object value) throws java.lang.Exception
set(target, expression, value)
.
setImpl
in class BaseLanguage
target
- beanexpression
- to setvalue
- to set
java.lang.Exception
public ExpressionParser getExpressionParser()
public void setExpressionParser(ExpressionParser expressionParser)
expressionParser
- The expressionParser to set.public BeanReflector getReflector()
public void setReflector(BeanReflector reflector)
reflector
- BeanReflector to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |