Package de.odysseus.el
Class ExpressionFactoryImpl
- java.lang.Object
-
- javax.el.ExpressionFactory
-
- de.odysseus.el.ExpressionFactoryImpl
-
public class ExpressionFactoryImpl extends javax.el.ExpressionFactory
Expression factory implementation. This class is also used as an EL "service provider". The juel-spi jar file specifies this class as el expression factory implementation inMETA-INF/services/javax.el.ExpressionFactory
. CallingExpressionFactory.newInstance()
will then return an instance of this class, configured as described below. If no properties are specified at construction time, properties are read from-
If the file
JAVA_HOME/lib/el.properties
exists and if it contains propertyjavax.el.ExpressionFactory
whose value is the name of this class, these properties are taken as default properties. - Otherwise, if system property
javax.el.ExpressionFactory
is set to the name of this class, the system propertiesSystem.getProperties()
are taken as default properties. -
el.properties
on your classpath. These properties override the properties fromJAVA_HOME/lib/el.properties
orSystem.getProperties()
.
Properties
. Having this, the following properties are read:-
javax.el.cacheSize
- cache size (int, default is 1000) -
javax.el.methodInvocations
- allow method invocations as in${foo.bar(baz)}
(boolean, default isfalse
). -
javax.el.nullProperties
- resolvenull
properties as in${foo[null]}
(boolean, default isfalse
). -
javax.el.varArgs
- support function/method calls using varargs (boolean, default isfalse
).
-
If the file
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExpressionFactoryImpl.Profile
A profile provides a default set of language features that will define the builder's behavior.
-
Field Summary
Fields Modifier and Type Field Description private TypeConverter
converter
static java.lang.String
PROP_CACHE_SIZE
javax.el.cacheSize
static java.lang.String
PROP_IGNORE_RETURN_TYPE
javax.el.ignoreReturnType
static java.lang.String
PROP_METHOD_INVOCATIONS
javax.el.methodInvocations
static java.lang.String
PROP_NULL_PROPERTIES
javax.el.nullProperties
static java.lang.String
PROP_VAR_ARGS
javax.el.varArgs
private TreeStore
store
-
Constructor Summary
Constructors Constructor Description ExpressionFactoryImpl()
Create a new expression factory using the default builder and cache implementations.ExpressionFactoryImpl(ExpressionFactoryImpl.Profile profile)
Create a new expression factory using the default builder and cache implementations.ExpressionFactoryImpl(ExpressionFactoryImpl.Profile profile, java.util.Properties properties)
Create a new expression factory using the default builder and cache implementations.ExpressionFactoryImpl(ExpressionFactoryImpl.Profile profile, java.util.Properties properties, TypeConverter converter)
Create a new expression factory using the default builder and cache implementations.ExpressionFactoryImpl(TreeStore store)
Create a new expression factory.ExpressionFactoryImpl(TreeStore store, TypeConverter converter)
Create a new expression factory.ExpressionFactoryImpl(java.util.Properties properties)
Create a new expression factory using the default builder and cache implementations.ExpressionFactoryImpl(java.util.Properties properties, TypeConverter converter)
Create a new expression factory using the default builder and cache implementations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
coerceToType(java.lang.Object obj, java.lang.Class<?> targetType)
TreeMethodExpression
createMethodExpression(javax.el.ELContext context, java.lang.String expression, java.lang.Class<?> expectedReturnType, java.lang.Class<?>[] expectedParamTypes)
protected TreeBuilder
createTreeBuilder(java.util.Properties properties, Builder.Feature... features)
Create the factory's builder.protected TreeStore
createTreeStore(int defaultCacheSize, ExpressionFactoryImpl.Profile profile, java.util.Properties properties)
Create the factory's tree store.protected TypeConverter
createTypeConverter(java.util.Properties properties)
Create the factory's type converter.ObjectValueExpression
createValueExpression(java.lang.Object instance, java.lang.Class<?> expectedType)
TreeValueExpression
createValueExpression(javax.el.ELContext context, java.lang.String expression, java.lang.Class<?> expectedType)
private boolean
getFeatureProperty(ExpressionFactoryImpl.Profile profile, java.util.Properties properties, Builder.Feature feature, java.lang.String property)
private java.lang.Class<?>
load(java.lang.Class<?> clazz, java.util.Properties properties)
private java.util.Properties
loadDefaultProperties()
private java.util.Properties
loadProperties(java.lang.String path)
-
-
-
Field Detail
-
PROP_METHOD_INVOCATIONS
public static final java.lang.String PROP_METHOD_INVOCATIONS
javax.el.methodInvocations
- See Also:
- Constant Field Values
-
PROP_VAR_ARGS
public static final java.lang.String PROP_VAR_ARGS
javax.el.varArgs
- See Also:
- Constant Field Values
-
PROP_NULL_PROPERTIES
public static final java.lang.String PROP_NULL_PROPERTIES
javax.el.nullProperties
- See Also:
- Constant Field Values
-
PROP_IGNORE_RETURN_TYPE
public static final java.lang.String PROP_IGNORE_RETURN_TYPE
javax.el.ignoreReturnType
- See Also:
- Constant Field Values
-
PROP_CACHE_SIZE
public static final java.lang.String PROP_CACHE_SIZE
javax.el.cacheSize
- See Also:
- Constant Field Values
-
store
private final TreeStore store
-
converter
private final TypeConverter converter
-
-
Constructor Detail
-
ExpressionFactoryImpl
public ExpressionFactoryImpl()
Create a new expression factory using the default builder and cache implementations. The builder and cache are configured fromel.properties
(see above). The maximum cache size will be 1000 unless overridden inel.properties
. The builder profile isExpressionFactoryImpl.Profile.JEE6
(features may be overridden inel.properties
).
-
ExpressionFactoryImpl
public ExpressionFactoryImpl(ExpressionFactoryImpl.Profile profile)
Create a new expression factory using the default builder and cache implementations. The builder and cache are configured from the specified profile andel.properties
(see above). The maximum cache size will be 1000 unless overridden inel.properties
.- Parameters:
profile
- builder profile (features may be overridden inel.properties
)- Since:
- 2.2
-
ExpressionFactoryImpl
public ExpressionFactoryImpl(java.util.Properties properties)
Create a new expression factory using the default builder and cache implementations. The builder and cache are configured using the specified properties. The maximum cache size will be 1000 unless overridden by propertyjavax.el.cacheSize
. The builder profile isExpressionFactoryImpl.Profile.JEE6
(features may be overridden inproperties
).- Parameters:
properties
- used to initialize this factory (may benull
)
-
ExpressionFactoryImpl
public ExpressionFactoryImpl(ExpressionFactoryImpl.Profile profile, java.util.Properties properties)
Create a new expression factory using the default builder and cache implementations. The builder and cache are configured using the specified profile and properties. The maximum cache size will be 1000 unless overridden by propertyjavax.el.cacheSize
.- Parameters:
profile
- builder profile (individual features may be overridden in properties)properties
- used to initialize this factory (may benull
)- Since:
- 2.2
-
ExpressionFactoryImpl
public ExpressionFactoryImpl(java.util.Properties properties, TypeConverter converter)
Create a new expression factory using the default builder and cache implementations. The builder and cache are configured using the specified properties. The maximum cache size will be 1000 unless overridden by propertyjavax.el.cacheSize
. The builder profile isExpressionFactoryImpl.Profile.JEE6
(individual features may be overridden inproperties
).- Parameters:
properties
- used to initialize this factory (may benull
)converter
- custom type converter
-
ExpressionFactoryImpl
public ExpressionFactoryImpl(ExpressionFactoryImpl.Profile profile, java.util.Properties properties, TypeConverter converter)
Create a new expression factory using the default builder and cache implementations. The builder and cache are configured using the specified profile and properties. The maximum cache size will be 1000 unless overridden by propertyjavax.el.cacheSize
.- Parameters:
profile
- builder profile (individual features may be overridden in properties)properties
- used to initialize this factory (may benull
)converter
- custom type converter- Since:
- 2.2
-
ExpressionFactoryImpl
public ExpressionFactoryImpl(TreeStore store)
Create a new expression factory.- Parameters:
store
- the tree store used to parse and cache parse trees.
-
ExpressionFactoryImpl
public ExpressionFactoryImpl(TreeStore store, TypeConverter converter)
Create a new expression factory.- Parameters:
store
- the tree store used to parse and cache parse trees.converter
- custom type converter
-
-
Method Detail
-
loadDefaultProperties
private java.util.Properties loadDefaultProperties()
-
loadProperties
private java.util.Properties loadProperties(java.lang.String path)
-
getFeatureProperty
private boolean getFeatureProperty(ExpressionFactoryImpl.Profile profile, java.util.Properties properties, Builder.Feature feature, java.lang.String property)
-
createTreeStore
protected TreeStore createTreeStore(int defaultCacheSize, ExpressionFactoryImpl.Profile profile, java.util.Properties properties)
Create the factory's tree store. This implementation creates a new tree store using the default builder and cache implementations. The builder and cache are configured using the specified properties. The maximum cache size will be as specified unless overridden by propertyjavax.el.cacheSize
.
-
createTypeConverter
protected TypeConverter createTypeConverter(java.util.Properties properties)
Create the factory's type converter. This implementation takes thede.odysseus.el.misc.TypeConverter
property as the name of a class implementing thede.odysseus.el.misc.TypeConverter
interface. If the property is not set, the default converter (TypeConverter.DEFAULT
) is used.
-
createTreeBuilder
protected TreeBuilder createTreeBuilder(java.util.Properties properties, Builder.Feature... features)
Create the factory's builder. This implementation takes thede.odysseus.el.tree.TreeBuilder
property as a name of a class implementing thede.odysseus.el.tree.TreeBuilder
interface. If the property is not set, a plainde.odysseus.el.tree.impl.Builder
is used. If the configured class is a subclass ofde.odysseus.el.tree.impl.Builder
and which provides a constructor taking an array ofBuilder.Feature
, this constructor will be invoked. Otherwise, the default constructor will be used.
-
load
private java.lang.Class<?> load(java.lang.Class<?> clazz, java.util.Properties properties)
-
coerceToType
public final java.lang.Object coerceToType(java.lang.Object obj, java.lang.Class<?> targetType)
- Specified by:
coerceToType
in classjavax.el.ExpressionFactory
-
createValueExpression
public final ObjectValueExpression createValueExpression(java.lang.Object instance, java.lang.Class<?> expectedType)
- Specified by:
createValueExpression
in classjavax.el.ExpressionFactory
-
createValueExpression
public final TreeValueExpression createValueExpression(javax.el.ELContext context, java.lang.String expression, java.lang.Class<?> expectedType)
- Specified by:
createValueExpression
in classjavax.el.ExpressionFactory
-
createMethodExpression
public final TreeMethodExpression createMethodExpression(javax.el.ELContext context, java.lang.String expression, java.lang.Class<?> expectedReturnType, java.lang.Class<?>[] expectedParamTypes)
- Specified by:
createMethodExpression
in classjavax.el.ExpressionFactory
-
-