IT. Expert System.

Java Enterprise Edition (EE)

ExpressionFactory


javax.el
Class ExpressionFactory

java.lang.Object
  javax.el.ExpressionFactory
public abstract class ExpressionFactory
extends java.lang.Object

Constructor Summary
ExpressionFactory()
           
 
Method Summary
abstract  java.lang.Object coerceToType(java.lang.Object obj, java.lang.Class<?> targetType)
          Coerces an object to a specific type according to the EL type conversion rules.
abstract  MethodExpression createMethodExpression(ELContext context, java.lang.String expression, java.lang.Class<?> expectedReturnType, java.lang.Class<?>[] expectedParamTypes)
          Parses an expression into a MethodExpression for later evaluation.
abstract  ValueExpression createValueExpression(ELContext context, java.lang.String expression, java.lang.Class<?> expectedType)
          Parses an expression into a ValueExpression for later evaluation.
abstract  ValueExpression createValueExpression(java.lang.Object instance, java.lang.Class<?> expectedType)
          Creates a ValueExpression that wraps an object instance.
static ExpressionFactory newInstance()
          Creates a new instance of a ExpressionFactory.
static ExpressionFactory newInstance(java.util.Properties properties)
          Create a new instance of a ExpressionFactory, with optional properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionFactory

public ExpressionFactory()
Method Detail

newInstance

public static ExpressionFactory newInstance()
Creates a new instance of a ExpressionFactory. This method uses the following ordered lookup procedure to determine the ExpressionFactory implementation class to load:
  • Use the Services API (as detailed in the JAR specification). If a resource with the name of META-INF/services/javax.el.ExpressionFactory exists, then its first line, if present, is used as the UTF-8 encoded name of the implementation class.
  • Use the properties file "lib/el.properties" in the JRE directory. If this file exists and it is readable by the java.util.Properties.load(InputStream) method, and it contains an entry whose key is "javax.el.ExpressionFactory", then the value of that entry is used as the name of the implementation class.
  • Use the javax.el.ExpressionFactory system property. If a system property with this name is defined, then its value is used as the name of the implementation class.
  • Use a platform default implementation.

newInstance

public static ExpressionFactory newInstance(java.util.Properties properties)

Create a new instance of a ExpressionFactory, with optional properties. This method uses the same lookup procedure as the one used in newInstance().

If the argument properties is not null, and if the implementation contains a constructor with a single parameter of type java.util.Properties, then the constructor is used to create the instance.

Properties are optional and can be ignored by an implementation.

The name of a property should start with "javax.el."

The following are some suggested names for properties.

  • javax.el.cacheSize

Parameters:
properties - Properties passed to the implementation. If null, then no properties.

createValueExpression

public abstract ValueExpression createValueExpression(ELContext context,
                                                      java.lang.String expression,
                                                      java.lang.Class<?> expectedType)
Parses an expression into a ValueExpression for later evaluation. Use this method for expressions that refer to values.

This method should perform syntactic validation of the expression. If in doing so it detects errors, it should raise an ELException.

Parameters:
context - The EL context used to parse the expression. The FunctionMapper and VariableMapper stored in the ELContext are used to resolve functions and variables found in the expression. They can be null, in which case functions or variables are not supported for this expression. The object returned must invoke the same functions and access the same variable mappings regardless of whether the mappings in the provided FunctionMapper and VariableMapper instances change between calling ExpressionFactory.createValueExpression() and any method on ValueExpression.

Note that within the EL, the ${} and #{} syntaxes are treated identically. This includes the use of VariableMapper and FunctionMapper at expression creation time. Each is invoked if not null, independent of whether the #{} or ${} syntax is used for the expression.

expression - The expression to parse
expectedType - The type the result of the expression will be coerced to after evaluation.
Returns:
The parsed expression
Throws:
java.lang.NullPointerException - Thrown if expectedType is null.
ELException - Thrown if there are syntactical errors in the provided expression.

createValueExpression

public abstract ValueExpression createValueExpression(java.lang.Object instance,
                                                      java.lang.Class<?> expectedType)
Creates a ValueExpression that wraps an object instance. This method can be used to pass any object as a ValueExpression. The wrapper ValueExpression is read only, and returns the wrapped object via its getValue() method, optionally coerced.

Parameters:
instance - The object instance to be wrapped.
expectedType - The type the result of the expression will be coerced to after evaluation. There will be no coercion if it is Object.class,
Throws:
java.lang.NullPointerException - Thrown if expectedType is null.

createMethodExpression

public abstract MethodExpression createMethodExpression(ELContext context,
                                                        java.lang.String expression,
                                                        java.lang.Class<?> expectedReturnType,
                                                        java.lang.Class<?>[] expectedParamTypes)
Parses an expression into a MethodExpression for later evaluation. Use this method for expressions that refer to methods.

If the expression is a String literal, a MethodExpression is created, which when invoked, returns the String literal, coerced to expectedReturnType. An ELException is thrown if expectedReturnType is void or if the coercion of the String literal to the expectedReturnType yields an error (see Section "1.16 Type Conversion").

This method should perform syntactic validation of the expression. If in doing so it detects errors, it should raise an ELException.

Parameters:
context - The EL context used to parse the expression. The FunctionMapper and VariableMapper stored in the ELContext are used to resolve functions and variables found in the expression. They can be null, in which case functions or variables are not supported for this expression. The object returned must invoke the same functions and access the same variable mappings regardless of whether the mappings in the provided FunctionMapper and VariableMapper instances change between calling ExpressionFactory.createMethodExpression() and any method on MethodExpression.

Note that within the EL, the ${} and #{} syntaxes are treated identically. This includes the use of VariableMapper and FunctionMapper at expression creation time. Each is invoked if not null, independent of whether the #{} or ${} syntax is used for the expression.

expression - The expression to parse
expectedReturnType - The expected return type for the method to be found. After evaluating the expression, the MethodExpression must check that the return type of the actual method matches this type. Passing in a value of null indicates the caller does not care what the return type is, and the check is disabled.
expectedParamTypes - The expected parameter types for the method to be found. Must be an array with no elements if there are no parameters expected. It is illegal to pass null, unless the method is specified with arugments in the EL expression, in which case these arguments are used for method selection, and this parameter is ignored.
Returns:
The parsed expression
Throws:
ELException - Thrown if there are syntactical errors in the provided expression.
java.lang.NullPointerException - if paramTypes is null.

coerceToType

public abstract java.lang.Object coerceToType(java.lang.Object obj,
                                              java.lang.Class<?> targetType)
Coerces an object to a specific type according to the EL type conversion rules.

An ELException is thrown if an error results from applying the conversion rules.

Parameters:
obj - The object to coerce.
targetType - The target type for the coercion.
Throws:
ELException - thrown if an error results from applying the conversion rules.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 718 / . Delta: 0.04072 с