Formatting according to EE4J rules
diff --git a/api/src/main/java/javax/el/ArrayELResolver.java b/api/src/main/java/javax/el/ArrayELResolver.java
index 11c5c8c..fd28340 100644
--- a/api/src/main/java/javax/el/ArrayELResolver.java
+++ b/api/src/main/java/javax/el/ArrayELResolver.java
@@ -25,19 +25,20 @@
/**
* Defines property resolution behavior on arrays.
*
- * <p>This resolver handles base objects that are Java language arrays.
- * It accepts any object as a property and coerces that object into an
- * integer index into the array. The resulting value is the value in the array
- * at that index.</p>
+ * <p>
+ * This resolver handles base objects that are Java language arrays. It accepts any object as a property and coerces
+ * that object into an integer index into the array. The resulting value is the value in the array at that index.
+ * </p>
*
- * <p>This resolver can be constructed in read-only mode, which means that
- * {@link #isReadOnly} will always return <code>true</code> and
- * {@link #setValue} will always throw
- * <code>PropertyNotWritableException</code>.</p>
+ * <p>
+ * This resolver can be constructed in read-only mode, which means that {@link #isReadOnly} will always return
+ * <code>true</code> and {@link #setValue} will always throw <code>PropertyNotWritableException</code>.
+ * </p>
*
- * <p><code>ELResolver</code>s are combined together using
- * {@link CompositeELResolver}s, to define rich semantics for evaluating
- * an expression. See the javadocs for {@link ELResolver} for details.</p>
+ * <p>
+ * <code>ELResolver</code>s are combined together using {@link CompositeELResolver}s, to define rich semantics for
+ * evaluating an expression. See the javadocs for {@link ELResolver} for details.
+ * </p>
*
* @see CompositeELResolver
* @see ELResolver
@@ -53,51 +54,41 @@
}
/**
- * Creates a new <code>ArrayELResolver</code> whose read-only status is
- * determined by the given parameter.
+ * Creates a new <code>ArrayELResolver</code> whose read-only status is determined by the given parameter.
*
- * @param isReadOnly <code>true</code> if this resolver cannot modify
- * arrays; <code>false</code> otherwise.
+ * @param isReadOnly <code>true</code> if this resolver cannot modify arrays; <code>false</code> otherwise.
*/
public ArrayELResolver(boolean isReadOnly) {
this.isReadOnly = isReadOnly;
}
/**
- * If the base object is an array, returns the most general acceptable type
- * for a value in this array.
+ * If the base object is an array, returns the most general acceptable type for a value in this array.
*
- * <p>If the base is a <code>array</code>, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this method
- * is called, the caller should ignore the return value.</p>
+ * <p>
+ * If the base is a <code>array</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>Assuming the base is an <code>array</code>, this method will always
- * return <code>base.getClass().getComponentType()</code>, which is
- * the most general type of component that can be stored at any given
- * index in the array.</p>
+ * <p>
+ * Assuming the base is an <code>array</code>, this method will always return
+ * <code>base.getClass().getComponentType()</code>, which is the most general type of component that can be stored at
+ * any given index in the array.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The array to analyze. Only bases that are Java language
- * arrays are handled by this resolver.
- * @param property The index of the element in the array to return the
- * acceptable type for. Will be coerced into an integer, but
- * otherwise ignored by this resolver.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the most general acceptable type; otherwise undefined.
- * @throws PropertyNotFoundException if the given index is out of
- * bounds for this array.
+ * @param base The array to analyze. Only bases that are Java language arrays are handled by this resolver.
+ * @param property The index of the element in the array to return the acceptable type for. Will be coerced into an
+ * integer, but otherwise ignored by this resolver.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the most general acceptable type; otherwise undefined.
+ * @throws PropertyNotFoundException if the given index is out of bounds for this array.
* @throws NullPointerException if context is <code>null</code>
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public Class<?> getType(ELContext context,
- Object base,
- Object property) {
+ public Class<?> getType(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
@@ -105,7 +96,7 @@
if (base != null && base.getClass().isArray()) {
context.setPropertyResolved(true);
- int index = toInteger (property);
+ int index = toInteger(property);
if (index < 0 || index >= Array.getLength(base)) {
throw new PropertyNotFoundException();
}
@@ -115,38 +106,27 @@
}
/**
- * If the base object is a Java language array, returns the value at the
- * given index. The index is specified by the <code>property</code>
- * argument, and coerced into an integer. If the coercion could not be
- * performed, an <code>IllegalArgumentException</code> is thrown. If the
- * index is out of bounds, <code>null</code> is returned.
+ * If the base object is a Java language array, returns the value at the given index. The index is specified by the
+ * <code>property</code> argument, and coerced into an integer. If the coercion could not be performed, an
+ * <code>IllegalArgumentException</code> is thrown. If the index is out of bounds, <code>null</code> is returned.
*
- * <p>If the base is a Java language array, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this
- * method is called, the caller should ignore the return value.</p>
+ * <p>
+ * If the base is a Java language array, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The array to analyze. Only bases that are Java language
- * arrays are handled by this resolver.
- * @param property The index of the value to be returned. Will be coerced
- * into an integer.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the value at the given index or <code>null</code>
- * if the index was out of bounds. Otherwise, undefined.
- * @throws IllegalArgumentException if the property could not be coerced
- * into an integer.
+ * @param base The array to analyze. Only bases that are Java language arrays are handled by this resolver.
+ * @param property The index of the value to be returned. Will be coerced into an integer.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the value at the given index or <code>null</code> if the index was out of bounds. Otherwise, undefined.
+ * @throws IllegalArgumentException if the property could not be coerced into an integer.
* @throws NullPointerException if context is <code>null</code>.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public Object getValue(ELContext context,
- Object base,
- Object property) {
+ public Object getValue(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
@@ -154,7 +134,7 @@
if (base != null && base.getClass().isArray()) {
context.setPropertyResolved(base, property);
- int index = toInteger (property);
+ int index = toInteger(property);
if (index >= 0 && index < Array.getLength(base)) {
return Array.get(base, index);
}
@@ -163,47 +143,36 @@
}
/**
- * If the base object is a Java language array, attempts to set the
- * value at the given index with the given value. The index is specified
- * by the <code>property</code> argument, and coerced into an integer.
- * If the coercion could not be performed, an
- * <code>IllegalArgumentException</code> is thrown. If the index is
- * out of bounds, a <code>PropertyNotFoundException</code> is thrown.
+ * If the base object is a Java language array, attempts to set the value at the given index with the given value. The
+ * index is specified by the <code>property</code> argument, and coerced into an integer. If the coercion could not be
+ * performed, an <code>IllegalArgumentException</code> is thrown. If the index is out of bounds, a
+ * <code>PropertyNotFoundException</code> is thrown.
*
- * <p>If the base is a Java language array, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this method
- * is called, the caller can safely assume no value was set.</p>
+ * <p>
+ * If the base is a Java language array, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller can safely assume no value was set.
+ * </p>
*
- * <p>If this resolver was constructed in read-only mode, this method will
- * always throw <code>PropertyNotWritableException</code>.</p>
+ * <p>
+ * If this resolver was constructed in read-only mode, this method will always throw
+ * <code>PropertyNotWritableException</code>.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The array to be modified. Only bases that are Java language
- * arrays are handled by this resolver.
- * @param property The index of the value to be set. Will be coerced
- * into an integer.
+ * @param base The array to be modified. Only bases that are Java language arrays are handled by this resolver.
+ * @param property The index of the value to be set. Will be coerced into an integer.
* @param val The value to be set at the given index.
- * @throws ClassCastException if the class of the specified element
- * prevents it from being added to this array.
+ * @throws ClassCastException if the class of the specified element prevents it from being added to this array.
* @throws NullPointerException if context is <code>null</code>.
- * @throws IllegalArgumentException if the property could not be coerced
- * into an integer, or if some aspect of the specified element
- * prevents it from being added to this array.
- * @throws PropertyNotWritableException if this resolver was constructed
- * in read-only mode.
- * @throws PropertyNotFoundException if the given index is out of
- * bounds for this array.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws IllegalArgumentException if the property could not be coerced into an integer, or if some aspect of the
+ * specified element prevents it from being added to this array.
+ * @throws PropertyNotWritableException if this resolver was constructed in read-only mode.
+ * @throws PropertyNotFoundException if the given index is out of bounds for this array.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public void setValue(ELContext context,
- Object base,
- Object property,
- Object val) {
+ public void setValue(ELContext context, Object base, Object property, Object val) {
if (context == null) {
throw new NullPointerException();
@@ -215,10 +184,10 @@
throw new PropertyNotWritableException();
}
Class<?> type = base.getClass().getComponentType();
- if (val != null && ! type.isAssignableFrom(val.getClass())) {
+ if (val != null && !type.isAssignableFrom(val.getClass())) {
throw new ClassCastException();
}
- int index = toInteger (property);
+ int index = toInteger(property);
if (index < 0 || index >= Array.getLength(base)) {
throw new PropertyNotFoundException();
}
@@ -227,41 +196,32 @@
}
/**
- * If the base object is a Java language array, returns whether a call to
- * {@link #setValue} will always fail.
+ * If the base object is a Java language array, returns whether a call to {@link #setValue} will always fail.
*
- * <p>If the base is a Java language array, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this method
- * is called, the caller should ignore the return value.</p>
+ * <p>
+ * If the base is a Java language array, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>If this resolver was constructed in read-only mode, this method will
- * always return <code>true</code>. Otherwise, it returns
- * <code>false</code>.</p>
+ * <p>
+ * If this resolver was constructed in read-only mode, this method will always return <code>true</code>. Otherwise, it
+ * returns <code>false</code>.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The array to analyze. Only bases that are a Java language
- * array are handled by this resolver.
- * @param property The index of the element in the array to return the
- * acceptable type for. Will be coerced into an integer, but
- * otherwise ignored by this resolver.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * <code>true</code> if calling the <code>setValue</code> method
- * will always fail or <code>false</code> if it is possible that
- * such a call may succeed; otherwise undefined.
- * @throws PropertyNotFoundException if the given index is out of
- * bounds for this array.
+ * @param base The array to analyze. Only bases that are a Java language array are handled by this resolver.
+ * @param property The index of the element in the array to return the acceptable type for. Will be coerced into an
+ * integer, but otherwise ignored by this resolver.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * <code>true</code> if calling the <code>setValue</code> method will always fail or <code>false</code> if it is
+ * possible that such a call may succeed; otherwise undefined.
+ * @throws PropertyNotFoundException if the given index is out of bounds for this array.
* @throws NullPointerException if context is <code>null</code>
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public boolean isReadOnly(ELContext context,
- Object base,
- Object property) {
+ public boolean isReadOnly(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
@@ -269,7 +229,7 @@
if (base != null && base.getClass().isArray()) {
context.setPropertyResolved(true);
- int index = toInteger (property);
+ int index = toInteger(property);
if (index < 0 || index >= Array.getLength(base)) {
throw new PropertyNotFoundException();
}
@@ -278,40 +238,34 @@
}
/**
- * Always returns <code>null</code>, since there is no reason to
- * iterate through set set of all integers.
+ * Always returns <code>null</code>, since there is no reason to iterate through set set of all integers.
*
- * <p>The {@link #getCommonPropertyType} method returns sufficient
- * information about what properties this resolver accepts.</p>
+ * <p>
+ * The {@link #getCommonPropertyType} method returns sufficient information about what properties this resolver accepts.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The array to analyze. Only bases that are a Java language
- * array are handled by this resolver.
+ * @param base The array to analyze. Only bases that are a Java language array are handled by this resolver.
* @return <code>null</code>.
*/
- public Iterator<FeatureDescriptor> getFeatureDescriptors(
- ELContext context,
- Object base) {
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return null;
}
/**
- * If the base object is a Java language array, returns the most general
- * type that this resolver accepts for the <code>property</code> argument.
- * Otherwise, returns <code>null</code>.
+ * If the base object is a Java language array, returns the most general type that this resolver accepts for the
+ * <code>property</code> argument. Otherwise, returns <code>null</code>.
*
- * <p>Assuming the base is an array, this method will always return
- * <code>Integer.class</code>. This is because arrays accept integers
- * for their index.</p>
+ * <p>
+ * Assuming the base is an array, this method will always return <code>Integer.class</code>. This is because arrays
+ * accept integers for their index.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The array to analyze. Only bases that are a Java language
- * array are handled by this resolver.
- * @return <code>null</code> if base is not a Java language array;
- * otherwise <code>Integer.class</code>.
+ * @param base The array to analyze. Only bases that are a Java language array are handled by this resolver.
+ * @return <code>null</code> if base is not a Java language array; otherwise <code>Integer.class</code>.
*/
- public Class<?> getCommonPropertyType(ELContext context,
- Object base) {
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
if (base != null && base.getClass().isArray()) {
return Integer.class;
@@ -328,7 +282,7 @@
return ((Character) p).charValue();
}
if (p instanceof Boolean) {
- return ((Boolean) p).booleanValue()? 1: 0;
+ return ((Boolean) p).booleanValue() ? 1 : 0;
}
if (p instanceof Number) {
return ((Number) p).intValue();
@@ -341,4 +295,3 @@
private boolean isReadOnly;
}
-
diff --git a/api/src/main/java/javax/el/BeanELResolver.java b/api/src/main/java/javax/el/BeanELResolver.java
index 0c64569..409e0f9 100644
--- a/api/src/main/java/javax/el/BeanELResolver.java
+++ b/api/src/main/java/javax/el/BeanELResolver.java
@@ -33,37 +33,38 @@
import java.util.concurrent.ConcurrentHashMap;
/**
- * Defines property resolution behavior on objects using the JavaBeans
- * component architecture.
+ * Defines property resolution behavior on objects using the JavaBeans component architecture.
*
- * <p>This resolver handles base objects of any type, as long as the
- * base is not <code>null</code>. It accepts any object as a property
- * or method, and coerces it to a string.
+ * <p>
+ * This resolver handles base objects of any type, as long as the base is not <code>null</code>. It accepts any object
+ * as a property or method, and coerces it to a string.
*
- * <p>For property resolution, the
- * property string is used to find a JavaBeans compliant property on
- * the base object. The value is accessed using JavaBeans getters and setters.
+ * <p>
+ * For property resolution, the property string is used to find a JavaBeans compliant property on the base object. The
+ * value is accessed using JavaBeans getters and setters.
* </p>
*
- * <p>For method resolution, the method string is the name
- * of the method in the bean. The parameter types can be optionally
- * specified to identify the method. If the parameter types are not
- * specified, the parameter objects are used in the method resolution.
+ * <p>
+ * For method resolution, the method string is the name of the method in the bean. The parameter types can be optionally
+ * specified to identify the method. If the parameter types are not specified, the parameter objects are used in the
+ * method resolution.
* </p>
*
- * <p>This resolver can be constructed in read-only mode, which means that
- * {@link #isReadOnly} will always return <code>true</code> and
- * {@link #setValue} will always throw
- * <code>PropertyNotWritableException</code>.</p>
+ * <p>
+ * This resolver can be constructed in read-only mode, which means that {@link #isReadOnly} will always return
+ * <code>true</code> and {@link #setValue} will always throw <code>PropertyNotWritableException</code>.
+ * </p>
*
- * <p><code>ELResolver</code>s are combined together using
- * {@link CompositeELResolver}s, to define rich semantics for evaluating
- * an expression. See the javadocs for {@link ELResolver} for details.</p>
+ * <p>
+ * <code>ELResolver</code>s are combined together using {@link CompositeELResolver}s, to define rich semantics for
+ * evaluating an expression. See the javadocs for {@link ELResolver} for details.
+ * </p>
*
- * <p>Because this resolver handles base objects of any type, it should
- * be placed near the end of a composite resolver. Otherwise, it will
- * claim to have resolved a property before any resolvers that come after
- * it get a chance to test if they can do so as well.</p>
+ * <p>
+ * Because this resolver handles base objects of any type, it should be placed near the end of a composite resolver.
+ * Otherwise, it will claim to have resolved a property before any resolvers that come after it get a chance to test if
+ * they can do so as well.
+ * </p>
*
* @see CompositeELResolver
* @see ELResolver
@@ -73,26 +74,23 @@
static private class BPSoftReference extends SoftReference<BeanProperties> {
final Class<?> key;
- BPSoftReference(Class<?> key, BeanProperties beanProperties,
- ReferenceQueue<BeanProperties> refQ) {
+
+ BPSoftReference(Class<?> key, BeanProperties beanProperties, ReferenceQueue<BeanProperties> refQ) {
super(beanProperties, refQ);
this.key = key;
}
}
- static private class SoftConcurrentHashMap extends
- ConcurrentHashMap<Class<?>, BeanProperties> {
+ static private class SoftConcurrentHashMap extends ConcurrentHashMap<Class<?>, BeanProperties> {
private static final int CACHE_INIT_SIZE = 1024;
- private ConcurrentHashMap<Class<?>, BPSoftReference> map =
- new ConcurrentHashMap<Class<?>, BPSoftReference>(CACHE_INIT_SIZE);
- private ReferenceQueue<BeanProperties> refQ =
- new ReferenceQueue<BeanProperties>();
+ private ConcurrentHashMap<Class<?>, BPSoftReference> map = new ConcurrentHashMap<Class<?>, BPSoftReference>(CACHE_INIT_SIZE);
+ private ReferenceQueue<BeanProperties> refQ = new ReferenceQueue<BeanProperties>();
// Remove map entries that have been placed on the queue by GC.
private void cleanup() {
BPSoftReference BPRef = null;
- while ((BPRef = (BPSoftReference)refQ.poll()) != null) {
+ while ((BPRef = (BPSoftReference) refQ.poll()) != null) {
map.remove(BPRef.key);
}
}
@@ -100,17 +98,15 @@
@Override
public BeanProperties put(Class<?> key, BeanProperties value) {
cleanup();
- BPSoftReference prev =
- map.put(key, new BPSoftReference(key, value, refQ));
- return prev == null? null: prev.get();
+ BPSoftReference prev = map.put(key, new BPSoftReference(key, value, refQ));
+ return prev == null ? null : prev.get();
}
@Override
public BeanProperties putIfAbsent(Class<?> key, BeanProperties value) {
cleanup();
- BPSoftReference prev =
- map.putIfAbsent(key, new BPSoftReference(key, value, refQ));
- return prev == null? null: prev.get();
+ BPSoftReference prev = map.putIfAbsent(key, new BPSoftReference(key, value, refQ));
+ return prev == null ? null : prev.get();
}
@Override
@@ -131,8 +127,7 @@
private boolean isReadOnly;
- private static final SoftConcurrentHashMap properties =
- new SoftConcurrentHashMap();
+ private static final SoftConcurrentHashMap properties = new SoftConcurrentHashMap();
/*
* Defines a property for a bean.
@@ -143,8 +138,7 @@
private Method writeMethod;
private PropertyDescriptor descriptor;
- public BeanProperty(Class<?> baseClass,
- PropertyDescriptor descriptor) {
+ public BeanProperty(Class<?> baseClass, PropertyDescriptor descriptor) {
this.descriptor = descriptor;
readMethod = ELUtil.getMethod(baseClass, descriptor.getReadMethod());
writeMethod = ELUtil.getMethod(baseClass, descriptor.getWriteMethod());
@@ -172,8 +166,7 @@
*/
final static class BeanProperties {
- private final Map<String, BeanProperty> propertyMap =
- new HashMap<String, BeanProperty>();
+ private final Map<String, BeanProperty> propertyMap = new HashMap<String, BeanProperty>();
public BeanProperties(Class<?> baseClass) {
PropertyDescriptor[] descriptors;
@@ -183,9 +176,8 @@
} catch (IntrospectionException ie) {
throw new ELException(ie);
}
- for (PropertyDescriptor pd: descriptors) {
- propertyMap.put(pd.getName(),
- new BeanProperty(baseClass, pd));
+ for (PropertyDescriptor pd : descriptors) {
+ propertyMap.put(pd.getName(), new BeanProperty(baseClass, pd));
}
}
@@ -202,58 +194,49 @@
}
/**
- * Creates a new <code>BeanELResolver</code> whose read-only status is
- * determined by the given parameter.
+ * Creates a new <code>BeanELResolver</code> whose read-only status is determined by the given parameter.
*
- * @param isReadOnly <code>true</code> if this resolver cannot modify
- * beans; <code>false</code> otherwise.
+ * @param isReadOnly <code>true</code> if this resolver cannot modify beans; <code>false</code> otherwise.
*/
public BeanELResolver(boolean isReadOnly) {
this.isReadOnly = isReadOnly;
}
/**
- * If the base object is not <code>null</code>, returns the most
- * general acceptable type that can be set on this bean property.
+ * If the base object is not <code>null</code>, returns the most general acceptable type that can be set on this bean
+ * property.
*
- * <p>If the base is not <code>null</code>, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this
- * method is called, the caller should ignore the return value.</p>
+ * <p>
+ * If the base is not <code>null</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>The provided property will first be coerced to a <code>String</code>.
- * If there is a <code>BeanInfoProperty</code> for this property and
- * there were no errors retrieving it, the <code>propertyType</code> of
- * the <code>propertyDescriptor</code> is returned. Otherwise, a
- * <code>PropertyNotFoundException</code> is thrown.</p>
+ * <p>
+ * The provided property will first be coerced to a <code>String</code>. If there is a <code>BeanInfoProperty</code> for
+ * this property and there were no errors retrieving it, the <code>propertyType</code> of the
+ * <code>propertyDescriptor</code> is returned. Otherwise, a <code>PropertyNotFoundException</code> is thrown.
+ * </p>
*
* @param context The context of this evaluation.
* @param base The bean to analyze.
- * @param property The name of the property to analyze. Will be coerced to
- * a <code>String</code>.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the most general acceptable type; otherwise undefined.
+ * @param property The name of the property to analyze. Will be coerced to a <code>String</code>.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the most general acceptable type; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if <code>base</code> is not
- * <code>null</code> and the specified property does not exist
- * or is not readable.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if <code>base</code> is not <code>null</code> and the specified property does not
+ * exist or is not readable.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public Class<?> getType(ELContext context,
- Object base,
- Object property) {
+ public Class<?> getType(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
- if (base == null || property == null){
+ if (base == null || property == null) {
return null;
}
@@ -263,48 +246,40 @@
}
/**
- * If the base object is not <code>null</code>, returns the current
- * value of the given property on this bean.
+ * If the base object is not <code>null</code>, returns the current value of the given property on this bean.
*
- * <p>If the base is not <code>null</code>, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this
- * method is called, the caller should ignore the return value.</p>
+ * <p>
+ * If the base is not <code>null</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>The provided property name will first be coerced to a
- * <code>String</code>. If the property is a readable property of the
- * base object, as per the JavaBeans specification, then return the
- * result of the getter call. If the getter throws an exception,
- * it is propagated to the caller. If the property is not found or is
- * not readable, a <code>PropertyNotFoundException</code> is thrown.</p>
+ * <p>
+ * The provided property name will first be coerced to a <code>String</code>. If the property is a readable property of
+ * the base object, as per the JavaBeans specification, then return the result of the getter call. If the getter throws
+ * an exception, it is propagated to the caller. If the property is not found or is not readable, a
+ * <code>PropertyNotFoundException</code> is thrown.
+ * </p>
*
* @param context The context of this evaluation.
* @param base The bean on which to get the property.
- * @param property The name of the property to get. Will be coerced to
- * a <code>String</code>.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the value of the given property. Otherwise, undefined.
+ * @param property The name of the property to get. Will be coerced to a <code>String</code>.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the value of the given property. Otherwise, undefined.
* @throws NullPointerException if context is <code>null</code>.
- * @throws PropertyNotFoundException if <code>base</code> is not
- * <code>null</code> and the specified property does not exist
- * or is not readable.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if <code>base</code> is not <code>null</code> and the specified property does not
+ * exist or is not readable.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public Object getValue(ELContext context,
- Object base,
- Object property) {
+ public Object getValue(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
- if (base == null || property == null){
+ if (base == null || property == null) {
return null;
}
@@ -312,10 +287,7 @@
Method method = bp.getReadMethod();
if (method == null) {
throw new PropertyNotFoundException(
- ELUtil.getExceptionMessageString(context,
- "propertyNotReadable",
- new Object[] { base.getClass().getName(),
- property.toString()}));
+ ELUtil.getExceptionMessageString(context, "propertyNotReadable", new Object[] { base.getClass().getName(), property.toString() }));
}
Object value;
@@ -333,74 +305,63 @@
}
/**
- * If the base object is not <code>null</code>, attempts to set the
- * value of the given property on this bean.
+ * If the base object is not <code>null</code>, attempts to set the value of the given property on this bean.
*
- * <p>If the base is not <code>null</code>, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this
- * method is called, the caller can safely assume no value was set.</p>
+ * <p>
+ * If the base is not <code>null</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller can safely assume no value was set.
+ * </p>
*
- * <p>If this resolver was constructed in read-only mode, this method will
- * always throw <code>PropertyNotWritableException</code>.</p>
+ * <p>
+ * If this resolver was constructed in read-only mode, this method will always throw
+ * <code>PropertyNotWritableException</code>.
+ * </p>
*
- * <p>The provided property name will first be coerced to a
- * <code>String</code>. If property is a writable property of
- * <code>base</code> (as per the JavaBeans Specification), the setter
- * method is called (passing <code>value</code>). If the property exists
- * but does not have a setter, then a
- * <code>PropertyNotFoundException</code> is thrown. If the property
- * does not exist, a <code>PropertyNotFoundException</code> is thrown.</p>
+ * <p>
+ * The provided property name will first be coerced to a <code>String</code>. If property is a writable property of
+ * <code>base</code> (as per the JavaBeans Specification), the setter method is called (passing <code>value</code>). If
+ * the property exists but does not have a setter, then a <code>PropertyNotFoundException</code> is thrown. If the
+ * property does not exist, a <code>PropertyNotFoundException</code> is thrown.
+ * </p>
*
* @param context The context of this evaluation.
* @param base The bean on which to set the property.
- * @param property The name of the property to set. Will be coerced to
- * a <code>String</code>.
+ * @param property The name of the property to set. Will be coerced to a <code>String</code>.
* @param val The value to be associated with the specified key.
* @throws NullPointerException if context is <code>null</code>.
- * @throws PropertyNotFoundException if <code>base</code> is not
- * <code>null</code> and the specified property does not exist.
- * @throws PropertyNotWritableException if this resolver was constructed
- * in read-only mode, or if there is no setter for the property.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if <code>base</code> is not <code>null</code> and the specified property does not
+ * exist.
+ * @throws PropertyNotWritableException if this resolver was constructed in read-only mode, or if there is no setter for
+ * the property.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public void setValue(ELContext context,
- Object base,
- Object property,
- Object val) {
+ public void setValue(ELContext context, Object base, Object property, Object val) {
if (context == null) {
throw new NullPointerException();
}
- if (base == null || property == null){
+ if (base == null || property == null) {
return;
}
if (isReadOnly) {
throw new PropertyNotWritableException(
- ELUtil.getExceptionMessageString(context,
- "resolverNotwritable",
- new Object[] { base.getClass().getName() }));
+ ELUtil.getExceptionMessageString(context, "resolverNotwritable", new Object[] { base.getClass().getName() }));
}
BeanProperty bp = getBeanProperty(context, base, property);
Method method = bp.getWriteMethod();
if (method == null) {
throw new PropertyNotWritableException(
- ELUtil.getExceptionMessageString(context,
- "propertyNotWritable",
- new Object[] { base.getClass().getName(),
- property.toString()}));
+ ELUtil.getExceptionMessageString(context, "propertyNotWritable", new Object[] { base.getClass().getName(), property.toString() }));
}
try {
- method.invoke(base, new Object[] {val});
+ method.invoke(base, new Object[] { val });
context.setPropertyResolved(base, property);
} catch (ELException ex) {
throw ex;
@@ -410,85 +371,64 @@
if (null == val) {
val = "null";
}
- String message = ELUtil.getExceptionMessageString(context,
- "setPropertyFailed",
- new Object[] { property.toString(),
- base.getClass().getName(), val });
+ String message = ELUtil.getExceptionMessageString(context, "setPropertyFailed",
+ new Object[] { property.toString(), base.getClass().getName(), val });
throw new ELException(message, ex);
}
}
/**
- * If the base object is not <code>null</code>, invoke the method, with
- * the given parameters on this bean. The return value from the method
- * is returned.
+ * If the base object is not <code>null</code>, invoke the method, with the given parameters on this bean. The return
+ * value from the method is returned.
*
- * <p>If the base is not <code>null</code>, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this
- * method is called, the caller should ignore the return value.</p>
+ * <p>
+ * If the base is not <code>null</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>The provided method object will first be coerced to a
- * <code>String</code>. The methods in the bean is then examined and
- * an attempt will be made to select one for invocation. If no suitable
- * can be found, a <code>MethodNotFoundException</code> is thrown.
+ * <p>
+ * The provided method object will first be coerced to a <code>String</code>. The methods in the bean is then examined
+ * and an attempt will be made to select one for invocation. If no suitable can be found, a
+ * <code>MethodNotFoundException</code> is thrown.
*
- * If the given paramTypes is not <code>null</code>, select the method
- * with the given name and parameter types.
+ * If the given paramTypes is not <code>null</code>, select the method with the given name and parameter types.
*
- * Else select the method with the given name that has the same number
- * of parameters. If there are more than one such method, the method
- * selection process is undefined.
+ * Else select the method with the given name that has the same number of parameters. If there are more than one such
+ * method, the method selection process is undefined.
*
- * Else select the method with the given name that takes a variable
- * number of arguments.
+ * Else select the method with the given name that takes a variable number of arguments.
*
- * Note the resolution for overloaded methods will likely be clarified
- * in a future version of the spec.
+ * Note the resolution for overloaded methods will likely be clarified in a future version of the spec.
*
- * The provide parameters are coerced to the corresponding parameter
- * types of the method, and the method is then invoked.
+ * The provide parameters are coerced to the corresponding parameter types of the method, and the method is then
+ * invoked.
*
* @param context The context of this evaluation.
* @param base The bean on which to invoke the method
- * @param method The simple name of the method to invoke.
- * Will be coerced to a <code>String</code>. If method is
- * "<init>"or "<clinit>" a MethodNotFoundException is
- * thrown.
- * @param paramTypes An array of Class objects identifying the
- * method's formal parameter types, in declared order.
- * Use an empty array if the method has no parameters.
- * Can be <code>null</code>, in which case the method's formal
- * parameter types are assumed to be unknown.
- * @param params The parameters to pass to the method, or
- * <code>null</code> if no parameters.
- * @return The result of the method invocation (<code>null</code> if
- * the method has a <code>void</code> return type).
+ * @param method The simple name of the method to invoke. Will be coerced to a <code>String</code>. If method is
+ * "<init>"or "<clinit>" a MethodNotFoundException is thrown.
+ * @param paramTypes An array of Class objects identifying the method's formal parameter types, in declared order. Use
+ * an empty array if the method has no parameters. Can be <code>null</code>, in which case the method's formal parameter
+ * types are assumed to be unknown.
+ * @param params The parameters to pass to the method, or <code>null</code> if no parameters.
+ * @return The result of the method invocation (<code>null</code> if the method has a <code>void</code> return type).
* @throws MethodNotFoundException if no suitable method can be found.
- * @throws ELException if an exception was thrown while performing
- * (base, method) resolution. The thrown exception must be
- * included as the cause property of this exception, if
- * available. If the exception thrown is an
- * <code>InvocationTargetException</code>, extract its
- * <code>cause</code> and pass it to the
- * <code>ELException</code> constructor.
+ * @throws ELException if an exception was thrown while performing (base, method) resolution. The thrown exception must
+ * be included as the cause property of this exception, if available. If the exception thrown is an
+ * <code>InvocationTargetException</code>, extract its <code>cause</code> and pass it to the <code>ELException</code>
+ * constructor.
* @since EL 2.2
*/
@Override
- public Object invoke(ELContext context,
- Object base,
- Object method,
- Class<?>[] paramTypes,
- Object[] params) {
+ public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) {
if (base == null || method == null) {
return null;
}
- Method m = ELUtil.findMethod(base.getClass(), method.toString(),
- paramTypes,params, false);
- for (Object p: params) {
+ Method m = ELUtil.findMethod(base.getClass(), method.toString(), paramTypes, params, false);
+ for (Object p : params) {
// If the parameters is a LambdaExpression, set the ELContext
// for its evaluation
if (p instanceof javax.el.LambdaExpression) {
@@ -501,52 +441,44 @@
}
/**
- * If the base object is not <code>null</code>, returns whether a call
- * to {@link #setValue} will always fail.
+ * If the base object is not <code>null</code>, returns whether a call to {@link #setValue} will always fail.
*
- * <p>If the base is not <code>null</code>, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this
- * method is called, the caller can safely assume no value was set.</p>
+ * <p>
+ * If the base is not <code>null</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller can safely assume no value was set.
+ * </p>
*
- * <p>If this resolver was constructed in read-only mode, this method will
- * always return <code>true</code>.</p>
+ * <p>
+ * If this resolver was constructed in read-only mode, this method will always return <code>true</code>.
+ * </p>
*
- * <p>The provided property name will first be coerced to a
- * <code>String</code>. If property is a writable property of
- * <code>base</code>, <code>false</code> is returned. If the property is
- * found but is not writable, <code>true</code> is returned. If the
- * property is not found, a <code>PropertyNotFoundException</code>
- * is thrown.</p>
+ * <p>
+ * The provided property name will first be coerced to a <code>String</code>. If property is a writable property of
+ * <code>base</code>, <code>false</code> is returned. If the property is found but is not writable, <code>true</code> is
+ * returned. If the property is not found, a <code>PropertyNotFoundException</code> is thrown.
+ * </p>
*
* @param context The context of this evaluation.
* @param base The bean to analyze.
- * @param property The name of the property to analyzed. Will be coerced to
- * a <code>String</code>.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * <code>true</code> if calling the <code>setValue</code> method
- * will always fail or <code>false</code> if it is possible that
- * such a call may succeed; otherwise undefined.
+ * @param property The name of the property to analyzed. Will be coerced to a <code>String</code>.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * <code>true</code> if calling the <code>setValue</code> method will always fail or <code>false</code> if it is
+ * possible that such a call may succeed; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if <code>base</code> is not
- * <code>null</code> and the specified property does not exist.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if <code>base</code> is not <code>null</code> and the specified property does not
+ * exist.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public boolean isReadOnly(ELContext context,
- Object base,
- Object property) {
+ public boolean isReadOnly(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
- if (base == null || property == null){
+ if (base == null || property == null) {
return false;
}
@@ -560,37 +492,30 @@
}
/**
- * If the base object is not <code>null</code>, returns an
- * <code>Iterator</code> containing the set of JavaBeans properties
- * available on the given object. Otherwise, returns <code>null</code>.
+ * If the base object is not <code>null</code>, returns an <code>Iterator</code> containing the set of JavaBeans
+ * properties available on the given object. Otherwise, returns <code>null</code>.
*
- * <p>The <code>Iterator</code> returned must contain zero or more
- * instances of {@link java.beans.FeatureDescriptor}. Each info object
- * contains information about a property in the bean, as obtained by
- * calling the <code>BeanInfo.getPropertyDescriptors</code> method.
- * The <code>FeatureDescriptor</code> is initialized using the same
- * fields as are present in the <code>PropertyDescriptor</code>,
- * with the additional required named attributes "<code>type</code>" and
- * "<code>resolvableAtDesignTime</code>" set as follows:
+ * <p>
+ * The <code>Iterator</code> returned must contain zero or more instances of {@link java.beans.FeatureDescriptor}. Each
+ * info object contains information about a property in the bean, as obtained by calling the
+ * <code>BeanInfo.getPropertyDescriptors</code> method. The <code>FeatureDescriptor</code> is initialized using the same
+ * fields as are present in the <code>PropertyDescriptor</code>, with the additional required named attributes
+ * "<code>type</code>" and "<code>resolvableAtDesignTime</code>" set as follows:
* <ul>
- * <li>{@link ELResolver#TYPE} - The runtime type of the property, from
- * <code>PropertyDescriptor.getPropertyType()</code>.</li>
- * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - <code>true</code>.</li>
+ * <li>{@link ELResolver#TYPE} - The runtime type of the property, from
+ * <code>PropertyDescriptor.getPropertyType()</code>.</li>
+ * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - <code>true</code>.</li>
* </ul>
*
*
* @param context The context of this evaluation.
* @param base The bean to analyze.
- * @return An <code>Iterator</code> containing zero or more
- * <code>FeatureDescriptor</code> objects, each representing a property
- * on this bean, or <code>null</code> if the <code>base</code>
- * object is <code>null</code>.
+ * @return An <code>Iterator</code> containing zero or more <code>FeatureDescriptor</code> objects, each representing a
+ * property on this bean, or <code>null</code> if the <code>base</code> object is <code>null</code>.
*/
@Override
- public Iterator<FeatureDescriptor> getFeatureDescriptors(
- ELContext context,
- Object base) {
- if (base == null){
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
+ if (base == null) {
return null;
}
@@ -602,9 +527,8 @@
if (info == null) {
return null;
}
- ArrayList<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>(
- info.getPropertyDescriptors().length);
- for (PropertyDescriptor pd: info.getPropertyDescriptors()) {
+ ArrayList<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>(info.getPropertyDescriptors().length);
+ for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
pd.setValue("type", pd.getPropertyType());
pd.setValue("resolvableAtDesignTime", Boolean.TRUE);
list.add(pd);
@@ -613,32 +537,28 @@
}
/**
- * If the base object is not <code>null</code>, returns the most
- * general type that this resolver accepts for the
+ * If the base object is not <code>null</code>, returns the most general type that this resolver accepts for the
* <code>property</code> argument. Otherwise, returns <code>null</code>.
*
- * <p>Assuming the base is not <code>null</code>, this method will always
- * return <code>Object.class</code>. This is because any object is
- * accepted as a key and is coerced into a string.</p>
+ * <p>
+ * Assuming the base is not <code>null</code>, this method will always return <code>Object.class</code>. This is because
+ * any object is accepted as a key and is coerced into a string.
+ * </p>
*
* @param context The context of this evaluation.
* @param base The bean to analyze.
- * @return <code>null</code> if base is <code>null</code>; otherwise
- * <code>Object.class</code>.
+ * @return <code>null</code> if base is <code>null</code>; otherwise <code>Object.class</code>.
*/
@Override
- public Class<?> getCommonPropertyType(ELContext context,
- Object base) {
- if (base == null){
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
+ if (base == null) {
return null;
}
return Object.class;
}
- private BeanProperty getBeanProperty(ELContext context,
- Object base,
- Object prop) {
+ private BeanProperty getBeanProperty(ELContext context, Object base, Object prop) {
String property = prop.toString();
Class baseClass = base.getClass();
@@ -649,13 +569,8 @@
}
BeanProperty bp = bps.getBeanProperty(property);
if (bp == null) {
- throw new PropertyNotFoundException(
- ELUtil.getExceptionMessageString(context,
- "propertyNotFound",
- new Object[] { baseClass.getName(),
- property}));
+ throw new PropertyNotFoundException(ELUtil.getExceptionMessageString(context, "propertyNotFound", new Object[] { baseClass.getName(), property }));
}
return bp;
}
}
-
diff --git a/api/src/main/java/javax/el/BeanNameELResolver.java b/api/src/main/java/javax/el/BeanNameELResolver.java
index f654826..0d29b19 100644
--- a/api/src/main/java/javax/el/BeanNameELResolver.java
+++ b/api/src/main/java/javax/el/BeanNameELResolver.java
@@ -20,10 +20,12 @@
import java.util.Iterator;
/**
- * <p>An <code>ELResolver</code> for resolving user or container managed beans.</p>
- * <p>A {@link BeanNameResolver} is required for its proper operation.
- * The following example creates an <code>ELResolver</code> that
- * resolves the name "bean" to an instance of MyBean.
+ * <p>
+ * An <code>ELResolver</code> for resolving user or container managed beans.
+ * </p>
+ * <p>
+ * A {@link BeanNameResolver} is required for its proper operation. The following example creates an
+ * <code>ELResolver</code> that resolves the name "bean" to an instance of MyBean.
*
* <pre>
* <code>
@@ -46,6 +48,7 @@
/**
* Constructor
+ *
* @param beanNameResolver The {@link BeanNameResolver} that resolves a bean name.
*/
public BeanNameELResolver(BeanNameResolver beanNameResolver) {
@@ -53,27 +56,23 @@
}
/**
- * If the base object is <code>null</code> and the property is a name
- * that is resolvable by the BeanNameResolver, returns the value
- * resolved by the BeanNameResolver.
+ * If the base object is <code>null</code> and the property is a name that is resolvable by the BeanNameResolver,
+ * returns the value resolved by the BeanNameResolver.
*
- * <p>If name is resolved by the BeanNameResolver, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this
- * method is called, the caller should ignore the return value.</p>
+ * <p>
+ * If name is resolved by the BeanNameResolver, the <code>propertyResolved</code> property of the <code>ELContext</code>
+ * object must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code>
+ * after this method is called, the caller should ignore the return value.
+ * </p>
*
* @param context The context of this evaluation.
* @param base <code>null</code>
* @param property The name of the bean.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the value of the bean with the given name. Otherwise, undefined.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the value of the bean with the given name. Otherwise, undefined.
* @throws NullPointerException if context is <code>null</code>.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
public Object getValue(ELContext context, Object base, Object property) {
@@ -90,41 +89,34 @@
}
/**
- * If the base is null and the property is a name that is resolvable by
- * the BeanNameResolver, the bean in the BeanNameResolver is set to the
- * given value.
+ * If the base is null and the property is a name that is resolvable by the BeanNameResolver, the bean in the
+ * BeanNameResolver is set to the given value.
*
- * <p>If the name is resolvable by the BeanNameResolver, or if the
- * BeanNameResolver allows creating a new bean,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller can
- * safely assume no value has been set.</p>
+ * <p>
+ * If the name is resolvable by the BeanNameResolver, or if the BeanNameResolver allows creating a new bean, the
+ * <code>propertyResolved</code> property of the <code>ELContext</code> object must be set to <code>true</code> by the
+ * resolver, before returning. If this property is not <code>true</code> after this method is called, the caller can
+ * safely assume no value has been set.
+ * </p>
*
* @param context The context of this evaluation.
* @param base <code>null</code>
* @param property The name of the bean
* @param value The value to set the bean with the given name to.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotWritableException if the BeanNameResolver does not
- * allow the bean to be modified.
- * @throws ELException if an exception was thrown while attempting to
- * set the bean with the given name. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotWritableException if the BeanNameResolver does not allow the bean to be modified.
+ * @throws ELException if an exception was thrown while attempting to set the bean with the given name. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public void setValue(ELContext context, Object base, Object property,
- Object value) {
+ public void setValue(ELContext context, Object base, Object property, Object value) {
if (context == null) {
throw new NullPointerException();
}
if (base == null && property instanceof String) {
String beanName = (String) property;
- if (beanNameResolver.isNameResolved(beanName) ||
- beanNameResolver.canCreateBean(beanName)) {
+ if (beanNameResolver.isNameResolved(beanName) || beanNameResolver.canCreateBean(beanName)) {
beanNameResolver.setBeanValue(beanName, value);
context.setPropertyResolved(base, property);
}
@@ -132,27 +124,22 @@
}
/**
- * If the base is null and the property is a name resolvable by
- * the BeanNameResolver, return the type of the bean.
+ * If the base is null and the property is a name resolvable by the BeanNameResolver, return the type of the bean.
*
- * <p>If the name is resolvable by the BeanNameResolver,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller can
- * safely assume no value has been set.</p>
+ * <p>
+ * If the name is resolvable by the BeanNameResolver, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller can safely assume no value has been set.
+ * </p>
*
* @param context The context of this evaluation.
* @param base <code>null</code>
* @param property The name of the bean.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the type of the bean with the given name. Otherwise, undefined.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the type of the bean with the given name. Otherwise, undefined.
* @throws NullPointerException if context is <code>null</code>.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
public Class<?> getType(ELContext context, Object base, Object property) {
@@ -171,28 +158,23 @@
}
/**
- * If the base is null and the property is a name resolvable by
- * the BeanNameResolver, attempts to determine if the bean is writable.
+ * If the base is null and the property is a name resolvable by the BeanNameResolver, attempts to determine if the bean
+ * is writable.
*
- * <p>If the name is resolvable by the BeanNameResolver,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller can
- * safely assume no value has been set.</p>
+ * <p>
+ * If the name is resolvable by the BeanNameResolver, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller can safely assume no value has been set.
+ * </p>
*
* @param context The context of this evaluation.
* @param base <code>null</code>
* @param property The name of the bean.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * <code>true</code> if the property is read-only or
- * <code>false</code> if not; otherwise undefined.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * <code>true</code> if the property is read-only or <code>false</code> if not; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
public boolean isReadOnly(ELContext context, Object base, Object property) {
@@ -210,20 +192,20 @@
}
/**
- * Always returns <code>null</code>, since there is no reason to
- * iterate through a list of one element: bean name.
+ * Always returns <code>null</code>, since there is no reason to iterate through a list of one element: bean name.
+ *
* @param context The context of this evaluation.
* @param base <code>null</code>.
* @return <code>null</code>.
*/
@Override
- public Iterator<FeatureDescriptor> getFeatureDescriptors(
- ELContext context, Object base) {
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return null;
}
/**
* Always returns <code>String.class</code>, since a bean name is a String.
+ *
* @param context The context of this evaluation.
* @param base <code>null</code>.
* @return <code>String.class</code>.
diff --git a/api/src/main/java/javax/el/BeanNameResolver.java b/api/src/main/java/javax/el/BeanNameResolver.java
index 3541173..9f7b3d1 100644
--- a/api/src/main/java/javax/el/BeanNameResolver.java
+++ b/api/src/main/java/javax/el/BeanNameResolver.java
@@ -17,9 +17,9 @@
package javax.el;
/**
- * Resolves a bean by its known name.
- * This class can be extended to return a bean object given its name,
- * to set a value to an existing bean, or to create a bean with the value.
+ * Resolves a bean by its known name. This class can be extended to return a bean object given its name, to set a value
+ * to an existing bean, or to create a bean with the value.
+ *
* @see BeanNameELResolver
*
* @since EL 3.0
@@ -29,8 +29,7 @@
* Returns whether the given name is resolved by the BeanNameResolver
*
* @param beanName The name of the bean.
- * @return true if the name is resolved by this BeanNameResolver; false
- * otherwise.
+ * @return true if the name is resolved by this BeanNameResolver; false otherwise.
*/
public boolean isNameResolved(String beanName) {
return false;
@@ -38,34 +37,32 @@
/**
* Returns the bean known by its name.
+ *
* @param beanName The name of the bean.
- * @return The bean with the given name. Can be <code>null</code>.
- *
+ * @return The bean with the given name. Can be <code>null</code>.
+ *
*/
public Object getBean(String beanName) {
return null;
}
/**
- * Sets a value to a bean of the given name.
- * If the bean of the given name
- * does not exist and if {@link #canCreateBean} is <code>true</code>,
- * one is created with the given value.
+ * Sets a value to a bean of the given name. If the bean of the given name does not exist and if {@link #canCreateBean}
+ * is <code>true</code>, one is created with the given value.
+ *
* @param beanName The name of the bean
- * @param value The value to set the bean to. Can be <code>null</code>.
- * @throws PropertyNotWritableException if the bean cannot be
- * modified or created.
+ * @param value The value to set the bean to. Can be <code>null</code>.
+ * @throws PropertyNotWritableException if the bean cannot be modified or created.
*/
- public void setBeanValue(String beanName, Object value)
- throws PropertyNotWritableException {
+ public void setBeanValue(String beanName, Object value) throws PropertyNotWritableException {
throw new PropertyNotWritableException();
}
/**
* Indicates if the bean of the given name is read-only or writable
+ *
* @param beanName The name of the bean
- * @return <code>true</code> if the bean can be set to a new value.
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the bean can be set to a new value. <code>false</code> otherwise.
*/
public boolean isReadOnly(String beanName) {
return true;
@@ -73,9 +70,9 @@
/**
* Allow creating a bean of the given name if it does not exist.
+ *
* @param beanName The name of the bean
- * @return <code>true</code> if bean creation is supported
- * <code>false</code> otherwise.
+ * @return <code>true</code> if bean creation is supported <code>false</code> otherwise.
*/
public boolean canCreateBean(String beanName) {
return false;
diff --git a/api/src/main/java/javax/el/CompositeELResolver.java b/api/src/main/java/javax/el/CompositeELResolver.java
index 554c80a..8da1b21 100644
--- a/api/src/main/java/javax/el/CompositeELResolver.java
+++ b/api/src/main/java/javax/el/CompositeELResolver.java
@@ -23,31 +23,31 @@
/**
* Maintains an ordered composite list of child <code>ELResolver</code>s.
*
- * <p>Though only a single <code>ELResolver</code> is associated with an
- * <code>ELContext</code>, there are usually multiple resolvers considered
- * for any given variable or property resolution. <code>ELResolver</code>s
- * are combined together using a <code>CompositeELResolver</code>, to define
- * rich semantics for evaluating an expression.</p>
+ * <p>
+ * Though only a single <code>ELResolver</code> is associated with an <code>ELContext</code>, there are usually multiple
+ * resolvers considered for any given variable or property resolution. <code>ELResolver</code>s are combined together
+ * using a <code>CompositeELResolver</code>, to define rich semantics for evaluating an expression.
+ * </p>
*
- * <p>For the {@link #getValue}, {@link #getType}, {@link #setValue} and
- * {@link #isReadOnly} methods, an <code>ELResolver</code> is not
- * responsible for resolving all possible (base, property) pairs. In fact,
- * most resolvers will only handle a <code>base</code> of a single type.
- * To indicate that a resolver has successfully resolved a particular
- * (base, property) pair, it must set the <code>propertyResolved</code>
- * property of the <code>ELContext</code> to <code>true</code>. If it could
- * not handle the given pair, it must leave this property alone. The caller
- * must ignore the return value of the method if <code>propertyResolved</code>
- * is <code>false</code>.</p>
+ * <p>
+ * For the {@link #getValue}, {@link #getType}, {@link #setValue} and {@link #isReadOnly} methods, an
+ * <code>ELResolver</code> is not responsible for resolving all possible (base, property) pairs. In fact, most resolvers
+ * will only handle a <code>base</code> of a single type. To indicate that a resolver has successfully resolved a
+ * particular (base, property) pair, it must set the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> to <code>true</code>. If it could not handle the given pair, it must leave this property
+ * alone. The caller must ignore the return value of the method if <code>propertyResolved</code> is <code>false</code>.
+ * </p>
*
- * <p>The <code>CompositeELResolver</code> initializes the
- * <code>ELContext.propertyResolved</code> flag to <code>false</code>, and uses
- * it as a stop condition for iterating through its component resolvers.</p>
+ * <p>
+ * The <code>CompositeELResolver</code> initializes the <code>ELContext.propertyResolved</code> flag to
+ * <code>false</code>, and uses it as a stop condition for iterating through its component resolvers.
+ * </p>
*
- * <p>The <code>ELContext.propertyResolved</code> flag is not used for the
- * design-time methods {@link #getFeatureDescriptors} and
- * {@link #getCommonPropertyType}. Instead, results are collected and
- * combined from all child <code>ELResolver</code>s for these methods.</p>
+ * <p>
+ * The <code>ELContext.propertyResolved</code> flag is not used for the design-time methods
+ * {@link #getFeatureDescriptors} and {@link #getCommonPropertyType}. Instead, results are collected and combined from
+ * all child <code>ELResolver</code>s for these methods.
+ * </p>
*
* @see ELContext
* @see ELResolver
@@ -63,11 +63,12 @@
/**
* Adds the given resolver to the list of component resolvers.
*
- * <p>Resolvers are consulted in the order in which they are added.</p>
+ * <p>
+ * Resolvers are consulted in the order in which they are added.
+ * </p>
*
* @param elResolver The component resolver to add.
- * @throws NullPointerException If the provided resolver is
- * <code>null</code>.
+ * @throws NullPointerException If the provided resolver is <code>null</code>.
*/
public void add(ELResolver elResolver) {
@@ -85,60 +86,49 @@
}
/**
- * Attempts to resolve the given <code>property</code> object on the given
- * <code>base</code> object by querying all component resolvers.
+ * Attempts to resolve the given <code>property</code> object on the given <code>base</code> object by querying all
+ * component resolvers.
*
- * <p>If this resolver handles the given (base, property) pair,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller should ignore
- * the return value.
+ * <p>
+ * If this resolver handles the given (base, property) pair, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller should ignore the return value.
*
- * <p>First, <code>propertyResolved</code> is set to <code>false</code> on
- * the provided <code>ELContext</code>.
+ * <p>
+ * First, <code>propertyResolved</code> is set to <code>false</code> on the provided <code>ELContext</code>.
*
- * <p>Next, for each component resolver in this composite:
+ * <p>
+ * Next, for each component resolver in this composite:
* <ol>
- * <li>The <code>getValue()</code> method is called, passing in
- * the provided <code>context</code>, <code>base</code> and
- * <code>property</code>.</li>
- * <li>If the <code>ELContext</code>'s <code>propertyResolved</code>
- * flag is <code>false</code> then iteration continues.</li>
- * <li>Otherwise, iteration stops and no more component resolvers are
- * considered. The value returned by <code>getValue()</code> is
- * returned by this method.</li>
+ * <li>The <code>getValue()</code> method is called, passing in the provided <code>context</code>, <code>base</code> and
+ * <code>property</code>.</li>
+ * <li>If the <code>ELContext</code>'s <code>propertyResolved</code> flag is <code>false</code> then iteration
+ * continues.</li>
+ * <li>Otherwise, iteration stops and no more component resolvers are considered. The value returned by
+ * <code>getValue()</code> is returned by this method.</li>
* </ol>
*
- * <p>If none of the component resolvers were able to perform this
- * operation, the value <code>null</code> is returned and the
- * <code>propertyResolved</code> flag remains set to
- * <code>false</code>.
+ * <p>
+ * If none of the component resolvers were able to perform this operation, the value <code>null</code> is returned and
+ * the <code>propertyResolved</code> flag remains set to <code>false</code>.
*
- * <p>Any exception thrown by component resolvers during the iteration
- * is propagated to the caller of this method.
+ * <p>
+ * Any exception thrown by component resolvers during the iteration is propagated to the caller of this method.
*
* @param context The context of this evaluation.
- * @param base The base object whose property value is to be returned,
- * or <code>null</code> to resolve a top-level variable.
+ * @param base The base object whose property value is to be returned, or <code>null</code> to resolve a top-level
+ * variable.
* @param property The property or variable to be resolved.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the result of the variable or property resolution; otherwise
- * undefined.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the result of the variable or property resolution; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if the given (base, property) pair
- * is handled by this <code>ELResolver</code> but the specified
- * variable or property does not exist or is not readable.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if the given (base, property) pair is handled by this <code>ELResolver</code> but
+ * the specified variable or property does not exist or is not readable.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public Object getValue(ELContext context,
- Object base,
- Object property) {
+ public Object getValue(ELContext context, Object base, Object property) {
context.setPropertyResolved(false);
@@ -153,68 +143,58 @@
}
/**
- * Attemps to resolve and invoke the given <code>method</code> on the given
- * <code>base</code> object by querying all component resolvers.
+ * Attemps to resolve and invoke the given <code>method</code> on the given <code>base</code> object by querying all
+ * component resolvers.
*
- * <p>If this resolver handles the given (base, method) pair,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller should ignore
- * the return value.</p>
+ * <p>
+ * If this resolver handles the given (base, method) pair, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>First, <code>propertyResolved</code> is set to <code>false</code> on
- * the provided <code>ELContext</code>.</p>
+ * <p>
+ * First, <code>propertyResolved</code> is set to <code>false</code> on the provided <code>ELContext</code>.
+ * </p>
*
- * <p>Next, for each component resolver in this composite:
+ * <p>
+ * Next, for each component resolver in this composite:
* <ol>
- * <li>The <code>invoke()</code> method is called, passing in
- * the provided <code>context</code>, <code>base</code>,
- * <code>method</code>, <code>paramTypes</code>, and
- * <code>params</code>.</li>
- * <li>If the <code>ELContext</code>'s <code>propertyResolved</code>
- * flag is <code>false</code> then iteration continues.</li>
- * <li>Otherwise, iteration stops and no more component resolvers are
- * considered. The value returned by <code>getValue()</code> is
- * returned by this method.</li>
+ * <li>The <code>invoke()</code> method is called, passing in the provided <code>context</code>, <code>base</code>,
+ * <code>method</code>, <code>paramTypes</code>, and <code>params</code>.</li>
+ * <li>If the <code>ELContext</code>'s <code>propertyResolved</code> flag is <code>false</code> then iteration
+ * continues.</li>
+ * <li>Otherwise, iteration stops and no more component resolvers are considered. The value returned by
+ * <code>getValue()</code> is returned by this method.</li>
* </ol>
*
- * <p>If none of the component resolvers were able to perform this
- * operation, the value <code>null</code> is returned and the
- * <code>propertyResolved</code> flag remains set to
- * <code>false</code></p>.
+ * <p>
+ * If none of the component resolvers were able to perform this operation, the value <code>null</code> is returned and
+ * the <code>propertyResolved</code> flag remains set to <code>false</code>
+ * </p>
+ * .
*
- * <p>Any exception thrown by component resolvers during the iteration
- * is propagated to the caller of this method.</p>
+ * <p>
+ * Any exception thrown by component resolvers during the iteration is propagated to the caller of this method.
+ * </p>
*
* @param context The context of this evaluation.
* @param base The bean on which to invoke the method
- * @param method The simple name of the method to invoke.
- * Will be coerced to a <code>String</code>.
- * @param paramTypes An array of Class objects identifying the
- * method's formal parameter types, in declared order.
- * Use an empty array if the method has no parameters.
- * Can be <code>null</code>, in which case the method's formal
- * parameter types are assumed to be unknown.
- * @param params The parameters to pass to the method, or
- * <code>null</code> if no parameters.
- * @return The result of the method invocation (<code>null</code> if
- * the method has a <code>void</code> return type).
+ * @param method The simple name of the method to invoke. Will be coerced to a <code>String</code>.
+ * @param paramTypes An array of Class objects identifying the method's formal parameter types, in declared order. Use
+ * an empty array if the method has no parameters. Can be <code>null</code>, in which case the method's formal parameter
+ * types are assumed to be unknown.
+ * @param params The parameters to pass to the method, or <code>null</code> if no parameters.
+ * @return The result of the method invocation (<code>null</code> if the method has a <code>void</code> return type).
* @since EL 2.2
*/
@Override
- public Object invoke(ELContext context,
- Object base,
- Object method,
- Class<?>[] paramTypes,
- Object[] params) {
+ public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) {
context.setPropertyResolved(false);
Object value;
for (int i = 0; i < size; i++) {
- value = elResolvers[i].invoke(context, base, method,
- paramTypes, params);
+ value = elResolvers[i].invoke(context, base, method, paramTypes, params);
if (context.isPropertyResolved()) {
return value;
}
@@ -223,63 +203,55 @@
}
/**
- * For a given <code>base</code> and <code>property</code>, attempts to
- * identify the most general type that is acceptable for an object to be
- * passed as the <code>value</code> parameter in a future call
- * to the {@link #setValue} method. The result is obtained by
- * querying all component resolvers.
+ * For a given <code>base</code> and <code>property</code>, attempts to identify the most general type that is
+ * acceptable for an object to be passed as the <code>value</code> parameter in a future call to the {@link #setValue}
+ * method. The result is obtained by querying all component resolvers.
*
- * <p>If this resolver handles the given (base, property) pair,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller should ignore
- * the return value.</p>
+ * <p>
+ * If this resolver handles the given (base, property) pair, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>First, <code>propertyResolved</code> is set to <code>false</code> on
- * the provided <code>ELContext</code>.</p>
+ * <p>
+ * First, <code>propertyResolved</code> is set to <code>false</code> on the provided <code>ELContext</code>.
+ * </p>
*
- * <p>Next, for each component resolver in this composite:
+ * <p>
+ * Next, for each component resolver in this composite:
* <ol>
- * <li>The <code>getType()</code> method is called, passing in
- * the provided <code>context</code>, <code>base</code> and
- * <code>property</code>.</li>
- * <li>If the <code>ELContext</code>'s <code>propertyResolved</code>
- * flag is <code>false</code> then iteration continues.</li>
- * <li>Otherwise, iteration stops and no more component resolvers are
- * considered. The value returned by <code>getType()</code> is
- * returned by this method.</li>
+ * <li>The <code>getType()</code> method is called, passing in the provided <code>context</code>, <code>base</code> and
+ * <code>property</code>.</li>
+ * <li>If the <code>ELContext</code>'s <code>propertyResolved</code> flag is <code>false</code> then iteration
+ * continues.</li>
+ * <li>Otherwise, iteration stops and no more component resolvers are considered. The value returned by
+ * <code>getType()</code> is returned by this method.</li>
* </ol>
*
- * <p>If none of the component resolvers were able to perform this
- * operation, the value <code>null</code> is returned and the
- * <code>propertyResolved</code> flag remains set to
- * <code>false</code></p>.
+ * <p>
+ * If none of the component resolvers were able to perform this operation, the value <code>null</code> is returned and
+ * the <code>propertyResolved</code> flag remains set to <code>false</code>
+ * </p>
+ * .
*
- * <p>Any exception thrown by component resolvers during the iteration
- * is propagated to the caller of this method.</p>
+ * <p>
+ * Any exception thrown by component resolvers during the iteration is propagated to the caller of this method.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The base object whose property value is to be analyzed,
- * or <code>null</code> to analyze a top-level variable.
- * @param property The property or variable to return the acceptable
- * type for.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the most general acceptable type; otherwise undefined.
+ * @param base The base object whose property value is to be analyzed, or <code>null</code> to analyze a top-level
+ * variable.
+ * @param property The property or variable to return the acceptable type for.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the most general acceptable type; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if the given (base, property) pair
- * is handled by this <code>ELResolver</code> but the specified
- * variable or property does not exist or is not readable.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if the given (base, property) pair is handled by this <code>ELResolver</code> but
+ * the specified variable or property does not exist or is not readable.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public Class<?> getType(ELContext context,
- Object base,
- Object property) {
+ public Class<?> getType(ELContext context, Object base, Object property) {
context.setPropertyResolved(false);
@@ -294,63 +266,48 @@
}
/**
- * Attempts to set the value of the given <code>property</code>
- * object on the given <code>base</code> object. All component
- * resolvers are asked to attempt to set the value.
+ * Attempts to set the value of the given <code>property</code> object on the given <code>base</code> object. All
+ * component resolvers are asked to attempt to set the value.
*
* <p>
- * If this resolver handles the given (base, property) pair,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller can
- * safely assume no value has been set.
+ * If this resolver handles the given (base, property) pair, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller can safely assume no value has been set.
*
* <p>
- * First, <code>propertyResolved</code> is set to <code>false</code> on
- * the provided <code>ELContext</code>.
+ * First, <code>propertyResolved</code> is set to <code>false</code> on the provided <code>ELContext</code>.
*
* <p>
* Next, for each component resolver in this composite:
* <ol>
- * <li>The <code>setValue()</code> method is called, passing in
- * the provided <code>context</code>, <code>base</code>,
- * <code>property</code> and <code>value</code>.</li>
- * <li>If the <code>ELContext</code>'s <code>propertyResolved</code>
- * flag is <code>false</code> then iteration continues.</li>
- * <li>Otherwise, iteration stops and no more component resolvers are
- * considered.</li>
+ * <li>The <code>setValue()</code> method is called, passing in the provided <code>context</code>, <code>base</code>,
+ * <code>property</code> and <code>value</code>.</li>
+ * <li>If the <code>ELContext</code>'s <code>propertyResolved</code> flag is <code>false</code> then iteration
+ * continues.</li>
+ * <li>Otherwise, iteration stops and no more component resolvers are considered.</li>
* </ol>
*
- * <p>If none of the component resolvers were able to perform this
- * operation, the <code>propertyResolved</code> flag remains set to
- * <code>false</code>.
+ * <p>
+ * If none of the component resolvers were able to perform this operation, the <code>propertyResolved</code> flag
+ * remains set to <code>false</code>.
*
- * <p>Any exception thrown by component resolvers during the iteration
- * is propagated to the caller of this method.
+ * <p>
+ * Any exception thrown by component resolvers during the iteration is propagated to the caller of this method.
*
* @param context The context of this evaluation.
- * @param base The base object whose property value is to be set,
- * or <code>null</code> to set a top-level variable.
+ * @param base The base object whose property value is to be set, or <code>null</code> to set a top-level variable.
* @param property The property or variable to be set.
* @param val The value to set the property or variable to.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if the given (base, property) pair
- * is handled by this <code>ELResolver</code> but the specified
- * variable or property does not exist.
- * @throws PropertyNotWritableException if the given (base, property)
- * pair is handled by this <code>ELResolver</code> but the specified
- * variable or property is not writable.
- * @throws ELException if an exception was thrown while attempting to
- * set the property or variable. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if the given (base, property) pair is handled by this <code>ELResolver</code> but
+ * the specified variable or property does not exist.
+ * @throws PropertyNotWritableException if the given (base, property) pair is handled by this <code>ELResolver</code>
+ * but the specified variable or property is not writable.
+ * @throws ELException if an exception was thrown while attempting to set the property or variable. The thrown exception
+ * must be included as the cause property of this exception, if available.
*/
@Override
- public void setValue(ELContext context,
- Object base,
- Object property,
- Object val) {
+ public void setValue(ELContext context, Object base, Object property, Object val) {
context.setPropertyResolved(false);
@@ -363,62 +320,54 @@
}
/**
- * For a given <code>base</code> and <code>property</code>, attempts to
- * determine whether a call to {@link #setValue} will always fail. The
- * result is obtained by querying all component resolvers.
+ * For a given <code>base</code> and <code>property</code>, attempts to determine whether a call to {@link #setValue}
+ * will always fail. The result is obtained by querying all component resolvers.
*
- * <p>If this resolver handles the given (base, property) pair,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller should ignore
- * the return value.</p>
+ * <p>
+ * If this resolver handles the given (base, property) pair, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>First, <code>propertyResolved</code> is set to <code>false</code> on
- * the provided <code>ELContext</code>.</p>
+ * <p>
+ * First, <code>propertyResolved</code> is set to <code>false</code> on the provided <code>ELContext</code>.
+ * </p>
*
- * <p>Next, for each component resolver in this composite:
+ * <p>
+ * Next, for each component resolver in this composite:
* <ol>
- * <li>The <code>isReadOnly()</code> method is called, passing in
- * the provided <code>context</code>, <code>base</code> and
- * <code>property</code>.</li>
- * <li>If the <code>ELContext</code>'s <code>propertyResolved</code>
- * flag is <code>false</code> then iteration continues.</li>
- * <li>Otherwise, iteration stops and no more component resolvers are
- * considered. The value returned by <code>isReadOnly()</code> is
- * returned by this method.</li>
+ * <li>The <code>isReadOnly()</code> method is called, passing in the provided <code>context</code>, <code>base</code>
+ * and <code>property</code>.</li>
+ * <li>If the <code>ELContext</code>'s <code>propertyResolved</code> flag is <code>false</code> then iteration
+ * continues.</li>
+ * <li>Otherwise, iteration stops and no more component resolvers are considered. The value returned by
+ * <code>isReadOnly()</code> is returned by this method.</li>
* </ol>
*
- * <p>If none of the component resolvers were able to perform this
- * operation, the value <code>false</code> is returned and the
- * <code>propertyResolved</code> flag remains set to
- * <code>false</code></p>.
+ * <p>
+ * If none of the component resolvers were able to perform this operation, the value <code>false</code> is returned and
+ * the <code>propertyResolved</code> flag remains set to <code>false</code>
+ * </p>
+ * .
*
- * <p>Any exception thrown by component resolvers during the iteration
- * is propagated to the caller of this method.</p>
+ * <p>
+ * Any exception thrown by component resolvers during the iteration is propagated to the caller of this method.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The base object whose property value is to be analyzed,
- * or <code>null</code> to analyze a top-level variable.
- * @param property The property or variable to return the read-only status
- * for.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * <code>true</code> if the property is read-only or
- * <code>false</code> if not; otherwise undefined.
+ * @param base The base object whose property value is to be analyzed, or <code>null</code> to analyze a top-level
+ * variable.
+ * @param property The property or variable to return the read-only status for.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * <code>true</code> if the property is read-only or <code>false</code> if not; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if the given (base, property) pair
- * is handled by this <code>ELResolver</code> but the specified
- * variable or property does not exist.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if the given (base, property) pair is handled by this <code>ELResolver</code> but
+ * the specified variable or property does not exist.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public boolean isReadOnly(ELContext context,
- Object base,
- Object property) {
+ public boolean isReadOnly(ELContext context, Object base, Object property) {
context.setPropertyResolved(false);
@@ -433,62 +382,53 @@
}
/**
- * Returns information about the set of variables or properties that
- * can be resolved for the given <code>base</code> object. One use for
- * this method is to assist tools in auto-completion. The results are
- * collected from all component resolvers.
+ * Returns information about the set of variables or properties that can be resolved for the given <code>base</code>
+ * object. One use for this method is to assist tools in auto-completion. The results are collected from all component
+ * resolvers.
*
- * <p>The <code>propertyResolved</code> property of the
- * <code>ELContext</code> is not relevant to this method.
- * The results of all <code>ELResolver</code>s are concatenated.</p>
+ * <p>
+ * The <code>propertyResolved</code> property of the <code>ELContext</code> is not relevant to this method. The results
+ * of all <code>ELResolver</code>s are concatenated.
+ * </p>
*
- * <p>The <code>Iterator</code> returned is an iterator over the
- * collection of <code>FeatureDescriptor</code> objects returned by
- * the iterators returned by each component resolver's
- * <code>getFeatureDescriptors</code> method. If <code>null</code> is
- * returned by a resolver, it is skipped.</p>
+ * <p>
+ * The <code>Iterator</code> returned is an iterator over the collection of <code>FeatureDescriptor</code> objects
+ * returned by the iterators returned by each component resolver's <code>getFeatureDescriptors</code> method. If
+ * <code>null</code> is returned by a resolver, it is skipped.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The base object whose set of valid properties is to
- * be enumerated, or <code>null</code> to enumerate the set of
- * top-level variables that this resolver can evaluate.
- * @return An <code>Iterator</code> containing zero or more (possibly
- * infinitely more) <code>FeatureDescriptor</code> objects, or
- * <code>null</code> if this resolver does not handle the given
- * <code>base</code> object or that the results are too complex to
- * represent with this method
+ * @param base The base object whose set of valid properties is to be enumerated, or <code>null</code> to enumerate the
+ * set of top-level variables that this resolver can evaluate.
+ * @return An <code>Iterator</code> containing zero or more (possibly infinitely more) <code>FeatureDescriptor</code>
+ * objects, or <code>null</code> if this resolver does not handle the given <code>base</code> object or that the results
+ * are too complex to represent with this method
*/
@Override
- public Iterator<FeatureDescriptor> getFeatureDescriptors(
- ELContext context,
- Object base) {
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return new CompositeIterator(elResolvers, size, context, base);
}
/**
- * Returns the most general type that this resolver accepts for the
- * <code>property</code> argument, given a <code>base</code> object.
- * One use for this method is to assist tools in auto-completion. The
- * result is obtained by querying all component resolvers.
+ * Returns the most general type that this resolver accepts for the <code>property</code> argument, given a
+ * <code>base</code> object. One use for this method is to assist tools in auto-completion. The result is obtained by
+ * querying all component resolvers.
*
- * <p>The <code>Class</code> returned is the most specific class that is
- * a common superclass of all the classes returned by each component
- * resolver's <code>getCommonPropertyType</code> method. If
- * <code>null</code> is returned by a resolver, it is skipped.</p>
+ * <p>
+ * The <code>Class</code> returned is the most specific class that is a common superclass of all the classes returned by
+ * each component resolver's <code>getCommonPropertyType</code> method. If <code>null</code> is returned by a resolver,
+ * it is skipped.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The base object to return the most general property
- * type for, or <code>null</code> to enumerate the set of
- * top-level variables that this resolver can evaluate.
- * @return <code>null</code> if this <code>ELResolver</code> does not
- * know how to handle the given <code>base</code> object; otherwise
- * <code>Object.class</code> if any type of <code>property</code>
- * is accepted; otherwise the most general <code>property</code>
- * type accepted for the given <code>base</code>.
+ * @param base The base object to return the most general property type for, or <code>null</code> to enumerate the set
+ * of top-level variables that this resolver can evaluate.
+ * @return <code>null</code> if this <code>ELResolver</code> does not know how to handle the given <code>base</code>
+ * object; otherwise <code>Object.class</code> if any type of <code>property</code> is accepted; otherwise the most
+ * general <code>property</code> type accepted for the given <code>base</code>.
*/
@Override
- public Class<?> getCommonPropertyType(ELContext context,
- Object base) {
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
Class<?> commonPropertyType = null;
for (int i = 0; i < size; i++) {
@@ -513,8 +453,9 @@
/**
* Converts an object to a specific type.
*
- * <p>An <code>ELException</code> is thrown if an error occurs during
- * the conversion.</p>
+ * <p>
+ * An <code>ELException</code> is thrown if an error occurs during the conversion.
+ * </p>
*
* @param context The context of this evaluation.
* @param obj The object to convert.
@@ -524,9 +465,7 @@
* @since EL 3.0
*/
@Override
- public Object convertToType(ELContext context,
- Object obj,
- Class<?> targetType) {
+ public Object convertToType(ELContext context, Object obj, Class<?> targetType) {
context.setPropertyResolved(false);
@@ -543,8 +482,7 @@
private ELResolver[] elResolvers;
private int size;
- private static class CompositeIterator
- implements Iterator<FeatureDescriptor> {
+ private static class CompositeIterator implements Iterator<FeatureDescriptor> {
ELResolver[] resolvers;
int size;
@@ -553,10 +491,7 @@
ELContext context;
Object base;
- CompositeIterator(ELResolver[] resolvers,
- int size,
- ELContext context,
- Object base) {
+ CompositeIterator(ELResolver[] resolvers, int size, ELContext context, Object base) {
this.resolvers = resolvers;
this.size = size;
this.context = context;
@@ -568,8 +503,7 @@
if (propertyIter == null || !propertyIter.hasNext()) {
while (index < size) {
ELResolver elResolver = resolvers[index++];
- propertyIter = elResolver.getFeatureDescriptors(
- context, base);
+ propertyIter = elResolver.getFeatureDescriptors(context, base);
if (propertyIter != null) {
return propertyIter.hasNext();
}
@@ -584,8 +518,7 @@
if (propertyIter == null || !propertyIter.hasNext()) {
while (index < size) {
ELResolver elResolver = resolvers[index++];
- propertyIter = elResolver.getFeatureDescriptors(
- context, base);
+ propertyIter = elResolver.getFeatureDescriptors(context, base);
if (propertyIter != null) {
return propertyIter.next();
}
@@ -601,4 +534,3 @@
}
}
}
-
diff --git a/api/src/main/java/javax/el/ELClass.java b/api/src/main/java/javax/el/ELClass.java
index e8f5d93..f33b977 100644
--- a/api/src/main/java/javax/el/ELClass.java
+++ b/api/src/main/java/javax/el/ELClass.java
@@ -17,11 +17,13 @@
package javax.el;
/**
- * <p>A runtime representation of a Class in the EL expressions.
- * It encapsulates the java.lang.Class instance.</p>
+ * <p>
+ * A runtime representation of a Class in the EL expressions. It encapsulates the java.lang.Class instance.
+ * </p>
*
- * <p>This class is used only in {@link StaticFieldELResolver} and will
- * probably only be of interest to EL implementors, and not EL users.
+ * <p>
+ * This class is used only in {@link StaticFieldELResolver} and will probably only be of interest to EL implementors,
+ * and not EL users.
*
* @since EL 3.0
*/
@@ -32,6 +34,7 @@
/**
* Constructor
+ *
* @param klass The Class instance
*/
public ELClass(Class<?> klass) {
@@ -40,6 +43,7 @@
/**
* Returns the Class instance
+ *
* @return The Class instance
*/
public Class<?> getKlass() {
diff --git a/api/src/main/java/javax/el/ELContext.java b/api/src/main/java/javax/el/ELContext.java
index a99c720..b288d1c 100644
--- a/api/src/main/java/javax/el/ELContext.java
+++ b/api/src/main/java/javax/el/ELContext.java
@@ -27,51 +27,41 @@
/**
* Context information for expression parsing and evaluation.
*
- * <p>To parse or evaluate an {@link Expression}, an <code>ELContext</code>
- * must be provided. The <code>ELContext</code> holds:
+ * <p>
+ * To parse or evaluate an {@link Expression}, an <code>ELContext</code> must be provided. The <code>ELContext</code>
+ * holds:
* <ul>
- * <li>a reference to {@link FunctionMapper} that will be used
- * to resolve EL Functions. This is used only in parsing.</li>
- * <li>a reference to {@link VariableMapper} that will be used
- * to resolve EL Variables. This is used only in parsing.</li>
- * <li>a reference to the base {@link ELResolver} that will be consulted
- * to resolve model objects and their properties</li>
- * <li>a collection of all the relevant context objects for use by
- * <code>ELResolver</code>s</li>
- * <li>state information during the evaluation of an expression, such as
- * whether a property has been resolved yet</li>
- * <li>a reference to {@link ImportHandler} that will be consulted to
- * resolve classes that have been imported</li>
- * <li>a reference to the arguments for the active {@link LambdaExpression}s</li>
- * <li>a reference to the list of registered evaluation listeners</li>
+ * <li>a reference to {@link FunctionMapper} that will be used to resolve EL Functions. This is used only in
+ * parsing.</li>
+ * <li>a reference to {@link VariableMapper} that will be used to resolve EL Variables. This is used only in
+ * parsing.</li>
+ * <li>a reference to the base {@link ELResolver} that will be consulted to resolve model objects and their
+ * properties</li>
+ * <li>a collection of all the relevant context objects for use by <code>ELResolver</code>s</li>
+ * <li>state information during the evaluation of an expression, such as whether a property has been resolved yet</li>
+ * <li>a reference to {@link ImportHandler} that will be consulted to resolve classes that have been imported</li>
+ * <li>a reference to the arguments for the active {@link LambdaExpression}s</li>
+ * <li>a reference to the list of registered evaluation listeners</li>
* </ul>
*
* <p>
- * The collection of context objects is necessary because each
- * <code>ELResolver</code> may need access to a different context object.
- * For example, JSP and Faces resolvers need access to a
- * {@link javax.servlet.jsp.JspContext} and a
+ * The collection of context objects is necessary because each <code>ELResolver</code> may need access to a different
+ * context object. For example, JSP and Faces resolvers need access to a {@link javax.servlet.jsp.JspContext} and a
* {@link javax.faces.context.FacesContext}, respectively.
*
* <p>
- * When used in a web container, the creation of
- * <code>ELContext</code> objects is controlled through
- * the underlying technology. For example, in JSP the
- * <code>JspContext.getELContext()</code> factory method is used.
- * Some technologies provide the ability to add an {@link ELContextListener}
- * so that applications and frameworks can ensure their own context objects
- * are attached to any newly created <code>ELContext</code>.
+ * When used in a web container, the creation of <code>ELContext</code> objects is controlled through the underlying
+ * technology. For example, in JSP the <code>JspContext.getELContext()</code> factory method is used. Some technologies
+ * provide the ability to add an {@link ELContextListener} so that applications and frameworks can ensure their own
+ * context objects are attached to any newly created <code>ELContext</code>.
*
* <p>
- * When used in a stand-alone environment, {@link StandardELContext}
- * provides a default <code>ELContext</code>, which is managed and modified
- * by {@link ELManager}.
+ * When used in a stand-alone environment, {@link StandardELContext} provides a default <code>ELContext</code>, which is
+ * managed and modified by {@link ELManager}.
*
* <p>
- * Because it stores state during expression evaluation, an
- * <code>ELContext</code> object is not thread-safe. Care should be taken
- * to never share an <code>ELContext</code> instance between two or more
- * threads.
+ * Because it stores state during expression evaluation, an <code>ELContext</code> object is not thread-safe. Care
+ * should be taken to never share an <code>ELContext</code> instance between two or more threads.
*
* @see ELContextListener
* @see ELContextEvent
@@ -87,29 +77,29 @@
public abstract class ELContext {
/**
- * Called to indicate that a <code>ELResolver</code> has successfully
- * resolved a given (base, property) pair.
- * Use {@link #setPropertyResolved(Object, Object)} if
- * resolved is true and to notify {@link EvaluationListener}s.
+ * Called to indicate that a <code>ELResolver</code> has successfully resolved a given (base, property) pair. Use
+ * {@link #setPropertyResolved(Object, Object)} if resolved is true and to notify {@link EvaluationListener}s.
*
- * <p>The {@link CompositeELResolver} checks this property to determine
- * whether it should consider or skip other component resolvers.</p>
+ * <p>
+ * The {@link CompositeELResolver} checks this property to determine whether it should consider or skip other component
+ * resolvers.
+ * </p>
*
* @see CompositeELResolver
- * @param resolved true if the property has been resolved, or false if
- * not.
+ * @param resolved true if the property has been resolved, or false if not.
*/
public void setPropertyResolved(boolean resolved) {
this.resolved = resolved;
}
/**
- * Called to indicate that a <code>ELResolver</code> has successfully
- * resolved a given (base, property) pair and to notify the
- * {@link EvaluationListener}s.
+ * Called to indicate that a <code>ELResolver</code> has successfully resolved a given (base, property) pair and to
+ * notify the {@link EvaluationListener}s.
*
- * <p>The {@link CompositeELResolver} checks this property to determine
- * whether it should consider or skip other component resolvers.</p>
+ * <p>
+ * The {@link CompositeELResolver} checks this property to determine whether it should consider or skip other component
+ * resolvers.
+ * </p>
*
* @see CompositeELResolver
* @param base The base object
@@ -124,11 +114,12 @@
}
/**
- * Returns whether an {@link ELResolver} has successfully resolved a
- * given (base, property) pair.
+ * Returns whether an {@link ELResolver} has successfully resolved a given (base, property) pair.
*
- * <p>The {@link CompositeELResolver} checks this property to determine
- * whether it should consider or skip other component resolvers.</p>
+ * <p>
+ * The {@link CompositeELResolver} checks this property to determine whether it should consider or skip other component
+ * resolvers.
+ * </p>
*
* @see CompositeELResolver
* @return true if the property has been resolved, or false if not.
@@ -140,22 +131,23 @@
/**
* Associates a context object with this <code>ELContext</code>.
*
- * <p>The <code>ELContext</code> maintains a collection of context objects
- * relevant to the evaluation of an expression. These context objects
- * are used by <code>ELResolver</code>s. This method is used to
- * add a context object to that collection.</p>
+ * <p>
+ * The <code>ELContext</code> maintains a collection of context objects relevant to the evaluation of an expression.
+ * These context objects are used by <code>ELResolver</code>s. This method is used to add a context object to that
+ * collection.
+ * </p>
*
- * <p>By convention, the <code>contextObject</code> will be of the
- * type specified by the <code>key</code>. However, this is not
- * required and the key is used strictly as a unique identifier.</p>
+ * <p>
+ * By convention, the <code>contextObject</code> will be of the type specified by the <code>key</code>. However, this is
+ * not required and the key is used strictly as a unique identifier.
+ * </p>
*
- * @param key The key used by an @{link ELResolver} to identify this
- * context object.
+ * @param key The key used by an @{link ELResolver} to identify this context object.
* @param contextObject The context object to add to the collection.
* @throws NullPointerException if key is null or contextObject is null.
*/
public void putContext(Class key, Object contextObject) {
- if((key == null) || (contextObject == null)) {
+ if ((key == null) || (contextObject == null)) {
throw new NullPointerException();
}
map.put(key, contextObject);
@@ -164,23 +156,23 @@
/**
* Returns the context object associated with the given key.
*
- * <p>The <code>ELContext</code> maintains a collection of context objects
- * relevant to the evaluation of an expression. These context objects
- * are used by <code>ELResolver</code>s. This method is used to
- * retrieve the context with the given key from the collection.</p>
+ * <p>
+ * The <code>ELContext</code> maintains a collection of context objects relevant to the evaluation of an expression.
+ * These context objects are used by <code>ELResolver</code>s. This method is used to retrieve the context with the
+ * given key from the collection.
+ * </p>
*
- * <p>By convention, the object returned will be of the type specified by
- * the <code>key</code>. However, this is not required and the key is
- * used strictly as a unique identifier.</p>
+ * <p>
+ * By convention, the object returned will be of the type specified by the <code>key</code>. However, this is not
+ * required and the key is used strictly as a unique identifier.
+ * </p>
*
- * @param key The unique identifier that was used to associate the
- * context object with this <code>ELContext</code>.
- * @return The context object associated with the given key, or null
- * if no such context was found.
+ * @param key The unique identifier that was used to associate the context object with this <code>ELContext</code>.
+ * @return The context object associated with the given key, or null if no such context was found.
* @throws NullPointerException if key is null.
*/
public Object getContext(Class key) {
- if(key == null) {
+ if (key == null) {
throw new NullPointerException();
}
return map.get(key);
@@ -189,22 +181,22 @@
/**
* Retrieves the <code>ELResolver</code> associated with this context.
*
- * <p>The <code>ELContext</code> maintains a reference to the
- * <code>ELResolver</code> that will be consulted to resolve variables
- * and properties during an expression evaluation. This method
- * retrieves the reference to the resolver.</p>
+ * <p>
+ * The <code>ELContext</code> maintains a reference to the <code>ELResolver</code> that will be consulted to resolve
+ * variables and properties during an expression evaluation. This method retrieves the reference to the resolver.
+ * </p>
*
- * <p>Once an <code>ELContext</code> is constructed, the reference to the
- * <code>ELResolver</code> associated with the context cannot be changed.</p>
+ * <p>
+ * Once an <code>ELContext</code> is constructed, the reference to the <code>ELResolver</code> associated with the
+ * context cannot be changed.
+ * </p>
*
- * @return The resolver to be consulted for variable and
- * property resolution during expression evaluation.
+ * @return The resolver to be consulted for variable and property resolution during expression evaluation.
*/
public abstract ELResolver getELResolver();
/**
- * Retrieves the <code>ImportHandler</code> associated with this
- * <code>ELContext</code>.
+ * Retrieves the <code>ImportHandler</code> associated with this <code>ELContext</code>.
*
* @return The import handler to manage imports of classes and packages.
* @since EL 3.0
@@ -217,11 +209,9 @@
}
/**
- * Retrieves the <code>FunctionMapper</code> associated with this
- * <code>ELContext</code>.
+ * Retrieves the <code>FunctionMapper</code> associated with this <code>ELContext</code>.
*
- * @return The function mapper to be consulted for the resolution of
- * EL functions.
+ * @return The function mapper to be consulted for the resolution of EL functions.
*/
public abstract FunctionMapper getFunctionMapper();
@@ -231,14 +221,11 @@
private Locale locale;
/**
- * Get the <code>Locale</code> stored by a previous invocation to
- * {@link #setLocale}. If this method returns non <code>null</code>,
- * this <code>Locale</code> must be used for all localization needs
- * in the implementation. The <code>Locale</code> must not be cached
- * to allow for applications that change <code>Locale</code> dynamically.
+ * Get the <code>Locale</code> stored by a previous invocation to {@link #setLocale}. If this method returns non
+ * <code>null</code>, this <code>Locale</code> must be used for all localization needs in the implementation. The
+ * <code>Locale</code> must not be cached to allow for applications that change <code>Locale</code> dynamically.
*
- * @return The <code>Locale</code> in which this instance is operating.
- * Used primarily for message localization.
+ * @return The <code>Locale</code> in which this instance is operating. Used primarily for message localization.
*/
public Locale getLocale() {
@@ -250,11 +237,9 @@
* Sets the <code>Locale</code> for this instance.
*
* <p>
- * This method may be
- * called by the party creating the instance, such as JavaServer
- * Faces or JSP, to enable the EL implementation to provide localized
- * messages to the user. If no <code>Locale</code> is set, the implementation
- * must use the locale returned by <code>Locale.getDefault( )</code>.
+ * This method may be called by the party creating the instance, such as JavaServer Faces or JSP, to enable the EL
+ * implementation to provide localized messages to the user. If no <code>Locale</code> is set, the implementation must
+ * use the locale returned by <code>Locale.getDefault( )</code>.
*
* @param locale the locale for this instance
*/
@@ -263,13 +248,10 @@
this.locale = locale;
}
-
/**
- * Retrieves the <code>VariableMapper</code> associated with this
- * <code>ELContext</code>.
+ * Retrieves the <code>VariableMapper</code> associated with this <code>ELContext</code>.
*
- * @return The variable mapper to be consulted for the resolution of
- * EL variables.
+ * @return The variable mapper to be consulted for the resolution of EL variables.
*/
public abstract VariableMapper getVariableMapper();
@@ -289,6 +271,7 @@
/**
* Returns the list of registered evaluation listeners.
+ *
* @return The list of registered evaluation listeners.
*
* @since EL 3.0
@@ -299,43 +282,47 @@
/**
* Notifies the listeners before an EL expression is evaluated
+ *
* @param expr The EL expression string to be evaluated
*/
public void notifyBeforeEvaluation(String expr) {
if (getEvaluationListeners() == null)
return;
- for (EvaluationListener listener: getEvaluationListeners()) {
+ for (EvaluationListener listener : getEvaluationListeners()) {
listener.beforeEvaluation(this, expr);
}
}
/**
* Notifies the listeners after an EL expression is evaluated
+ *
* @param expr The EL expression string that has been evaluated
*/
public void notifyAfterEvaluation(String expr) {
if (getEvaluationListeners() == null)
return;
- for (EvaluationListener listener: getEvaluationListeners()) {
+ for (EvaluationListener listener : getEvaluationListeners()) {
listener.afterEvaluation(this, expr);
}
}
/**
* Notifies the listeners when the (base, property) pair is resolved
+ *
* @param base The base object
* @param property The property Object
*/
public void notifyPropertyResolved(Object base, Object property) {
if (getEvaluationListeners() == null)
return;
- for (EvaluationListener listener: getEvaluationListeners()) {
+ for (EvaluationListener listener : getEvaluationListeners()) {
listener.propertyResolved(this, base, property);
}
}
/**
* Inquires if the name is a LambdaArgument
+ *
* @param arg A possible Lambda formal parameter name
* @return true if arg is a LambdaArgument, false otherwise.
*/
@@ -354,15 +341,12 @@
}
/**
- * Retrieves the Lambda argument associated with a formal parameter.
- * If the Lambda expression is nested within other Lambda expressions, the
- * arguments for the current Lambda expression is first searched, and if
- * not found, the arguments for the immediate nesting Lambda expression
- * then searched, and so on.
+ * Retrieves the Lambda argument associated with a formal parameter. If the Lambda expression is nested within other
+ * Lambda expressions, the arguments for the current Lambda expression is first searched, and if not found, the
+ * arguments for the immediate nesting Lambda expression then searched, and so on.
*
* @param arg The formal parameter for the Lambda argument
- * @return The object associated with formal parameter. Null if
- * no object has been associated with the parameter.
+ * @return The object associated with formal parameter. Null if no object has been associated with the parameter.
* @since EL 3.0
*/
public Object getLambdaArgument(String arg) {
@@ -381,22 +365,22 @@
}
/**
- * Installs a Lambda argument map, in preparation for the evaluation
- * of a Lambda expression. The arguments in the map will be in scope
- * during the evaluation of the Lambda expression.
+ * Installs a Lambda argument map, in preparation for the evaluation of a Lambda expression. The arguments in the map
+ * will be in scope during the evaluation of the Lambda expression.
+ *
* @param args The Lambda arguments map
* @since EL 3.0
*/
- public void enterLambdaScope(Map<String,Object> args) {
+ public void enterLambdaScope(Map<String, Object> args) {
if (lambdaArgs == null) {
- lambdaArgs = new Stack<Map<String,Object>>();
+ lambdaArgs = new Stack<Map<String, Object>>();
}
lambdaArgs.push(args);
}
/**
- * Exits the Lambda expression evaluation. The Lambda argument map that
- * was previously installed is removed.
+ * Exits the Lambda expression evaluation. The Lambda argument map that was previously installed is removed.
+ *
* @since EL 3.0
*/
public void exitLambdaScope() {
@@ -406,12 +390,11 @@
}
/**
- * Converts an object to a specific type. If a custom converter in the
- * <code>ELResolver</code> handles this conversion, it is used. Otherwise
- * the standard coercions is applied.
+ * Converts an object to a specific type. If a custom converter in the <code>ELResolver</code> handles this conversion,
+ * it is used. Otherwise the standard coercions is applied.
*
- * <p>An <code>ELException</code> is thrown if an error occurs during
- * the conversion.
+ * <p>
+ * An <code>ELException</code> is thrown if an error occurs during the conversion.
*
* @param obj The object to convert.
* @param targetType The target type for the conversion.
@@ -420,8 +403,7 @@
*
* @since EL 3.0
*/
- public Object convertToType(Object obj,
- Class<?> targetType) {
+ public Object convertToType(Object obj, Class<?> targetType) {
boolean propertyResolvedSave = isPropertyResolved();
try {
setPropertyResolved(false);
@@ -440,7 +422,7 @@
setPropertyResolved(propertyResolvedSave);
}
- ExpressionFactory exprFactory = (ExpressionFactory)getContext(ExpressionFactory.class);
+ ExpressionFactory exprFactory = (ExpressionFactory) getContext(ExpressionFactory.class);
if (exprFactory == null) {
exprFactory = ELUtil.getExpressionFactory();
}
@@ -450,7 +432,6 @@
private boolean resolved;
private HashMap<Class<?>, Object> map = new HashMap<Class<?>, Object>();
private transient List<EvaluationListener> listeners = null;
- private Stack<Map<String,Object>> lambdaArgs;
+ private Stack<Map<String, Object>> lambdaArgs;
private ImportHandler importHandler;
}
-
diff --git a/api/src/main/java/javax/el/ELContextEvent.java b/api/src/main/java/javax/el/ELContextEvent.java
index 2af7b92..4294221 100644
--- a/api/src/main/java/javax/el/ELContextEvent.java
+++ b/api/src/main/java/javax/el/ELContextEvent.java
@@ -18,8 +18,8 @@
package javax.el;
/**
- * An event which indicates that an {@link ELContext} has been created.
- * The source object is the ELContext that was created.
+ * An event which indicates that an {@link ELContext} has been created. The source object is the ELContext that was
+ * created.
*
* @see ELContext
* @see ELContextListener
@@ -28,8 +28,7 @@
public class ELContextEvent extends java.util.EventObject {
/**
- * Constructs an ELContextEvent object to indicate that an
- * <code>ELContext</code> has been created.
+ * Constructs an ELContextEvent object to indicate that an <code>ELContext</code> has been created.
*
* @param source the <code>ELContext</code> that was created.
*/
@@ -38,8 +37,7 @@
}
/**
- * Returns the <code>ELContext</code> that was created.
- * This is a type-safe equivalent of the {@link #getSource} method.
+ * Returns the <code>ELContext</code> that was created. This is a type-safe equivalent of the {@link #getSource} method.
*
* @return the ELContext that was created.
*/
diff --git a/api/src/main/java/javax/el/ELContextListener.java b/api/src/main/java/javax/el/ELContextListener.java
index b4df47b..5508887 100644
--- a/api/src/main/java/javax/el/ELContextListener.java
+++ b/api/src/main/java/javax/el/ELContextListener.java
@@ -18,8 +18,7 @@
package javax.el;
/**
- * The listener interface for receiving notification when an
- * {@link ELContext} is created.
+ * The listener interface for receiving notification when an {@link ELContext} is created.
*
* @see ELContext
* @see ELContextEvent
diff --git a/api/src/main/java/javax/el/ELException.java b/api/src/main/java/javax/el/ELException.java
index 3f39601..8cc0344 100644
--- a/api/src/main/java/javax/el/ELException.java
+++ b/api/src/main/java/javax/el/ELException.java
@@ -18,51 +18,49 @@
package javax.el;
/**
- * Represents any of the exception conditions that can arise during
- * expression evaluation.
+ * Represents any of the exception conditions that can arise during expression evaluation.
*
* @since JSP 2.1
*/
public class ELException extends RuntimeException {
- //-------------------------------------
+ // -------------------------------------
/**
* Creates an <code>ELException</code> with no detail message.
*/
- public ELException () {
- super ();
+ public ELException() {
+ super();
}
- //-------------------------------------
+ // -------------------------------------
/**
* Creates an <code>ELException</code> with the provided detail message.
*
* @param pMessage the detail message
*/
- public ELException (String pMessage) {
- super (pMessage);
+ public ELException(String pMessage) {
+ super(pMessage);
}
- //-------------------------------------
+ // -------------------------------------
/**
* Creates an <code>ELException</code> with the given cause.
*
* @param pRootCause the originating cause of this exception
*/
- public ELException (Throwable pRootCause) {
- super( pRootCause );
+ public ELException(Throwable pRootCause) {
+ super(pRootCause);
}
- //-------------------------------------
+ // -------------------------------------
/**
* Creates an ELException with the given detail message and root cause.
*
* @param pMessage the detail message
* @param pRootCause the originating cause of this exception
*/
- public ELException (String pMessage,
- Throwable pRootCause) {
- super (pMessage, pRootCause);
+ public ELException(String pMessage, Throwable pRootCause) {
+ super(pMessage, pRootCause);
}
}
diff --git a/api/src/main/java/javax/el/ELManager.java b/api/src/main/java/javax/el/ELManager.java
index de54777..0a66788 100644
--- a/api/src/main/java/javax/el/ELManager.java
+++ b/api/src/main/java/javax/el/ELManager.java
@@ -19,9 +19,10 @@
import java.lang.reflect.Method;
/**
- * <p>Manages EL parsing and evaluation environment. The ELManager maintains an
- * instance of ExpressionFactory and StandardELContext, for
- * parsing and evaluating EL expressions.</p>
+ * <p>
+ * Manages EL parsing and evaluation environment. The ELManager maintains an instance of ExpressionFactory and
+ * StandardELContext, for parsing and evaluating EL expressions.
+ * </p>
*
* @since EL 3.0
*/
@@ -31,6 +32,7 @@
/**
* Return the ExpressionFactory instance used for EL evaluations.
+ *
* @return The ExpressionFactory
*/
public static ExpressionFactory getExpressionFactory() {
@@ -38,9 +40,8 @@
}
/**
- * Return the ELContext used for parsing and evaluating EL expressions.
- * If there is currently no ELContext, a default instance of
- * StandardELContext is returned.
+ * Return the ELContext used for parsing and evaluating EL expressions. If there is currently no ELContext, a default
+ * instance of StandardELContext is returned.
*
* @return The ELContext used for parsing and evaluating EL expressions..
*/
@@ -52,9 +53,9 @@
}
/**
- * Set the ELContext used for parsing and evaluating EL expressions.
- * The supplied ELContext will not be modified, except for the context
- * object map.
+ * Set the ELContext used for parsing and evaluating EL expressions. The supplied ELContext will not be modified, except
+ * for the context object map.
+ *
* @param context The new ELContext.
* @return The previous ELContext, null if none.
*/
@@ -65,10 +66,9 @@
}
/**
- * Register a BeanNameResolver.
- * Construct a BeanNameELResolver with the BeanNameResolver and add it
- * to the list of ELResolvers.
- * Once registered, the BeanNameResolver cannot be removed.
+ * Register a BeanNameResolver. Construct a BeanNameELResolver with the BeanNameResolver and add it to the list of
+ * ELResolvers. Once registered, the BeanNameResolver cannot be removed.
+ *
* @param bnr The BeanNameResolver to be registered.
*/
public void addBeanNameResolver(BeanNameResolver bnr) {
@@ -76,13 +76,10 @@
}
/**
- * Add an user defined ELResolver to the list of ELResolvers.
- * Can be called multiple times. The new ELResolver is
- * placed ahead of the default ELResolvers. The list of the ELResolvers
- * added this way are ordered chronologically.
+ * Add an user defined ELResolver to the list of ELResolvers. Can be called multiple times. The new ELResolver is placed
+ * ahead of the default ELResolvers. The list of the ELResolvers added this way are ordered chronologically.
*
- * @param elr The ELResolver to be added to the list of ELResolvers in
- * ELContext.
+ * @param elr The ELResolver to be added to the list of ELResolvers in ELContext.
* @see StandardELContext#addELResolver
*/
public void addELResolver(ELResolver elr) {
@@ -91,6 +88,7 @@
/**
* Maps a static method to an EL function.
+ *
* @param prefix The namespace of the functions, can be "".
* @param function The name of the function.
* @param meth The static method to be invoked when the function is used.
@@ -100,22 +98,20 @@
}
/**
- * Assign a ValueExpression to an EL variable, replacing
- * any previous assignment to the same variable.
- * The assignment for the variable is removed if
- * the expression is <code>null</code>.
+ * Assign a ValueExpression to an EL variable, replacing any previous assignment to the same variable. The assignment
+ * for the variable is removed if the expression is <code>null</code>.
*
* @param variable The variable name
- * @param expression The ValueExpression to be assigned
- * to the variable.
+ * @param expression The ValueExpression to be assigned to the variable.
*/
public void setVariable(String variable, ValueExpression expression) {
getELContext().getVariableMapper().setVariable(variable, expression);
}
/**
- * Import a static field or method. The class of the static member must be
- * loadable from the classloader, at class resolution time.
+ * Import a static field or method. The class of the static member must be loadable from the classloader, at class
+ * resolution time.
+ *
* @param staticMemberName The full class name of the class to be imported
* @throws ELException if the name is not a full class name.
*/
@@ -124,8 +120,8 @@
}
/**
- * Import a class. The imported class must be loadable from the classloader
- * at the expression evaluation time.
+ * Import a class. The imported class must be loadable from the classloader at the expression evaluation time.
+ *
* @param className The full class name of the class to be imported
* @throws ELException if the name is not a full class name.
*/
@@ -134,10 +130,9 @@
}
/**
- * Import a package. At the expression evaluation time, the imported package
- * name will be used to construct the full class name, which will then be
- * used to load the class. Inherently, this is less efficient than
- * importing a class.
+ * Import a package. At the expression evaluation time, the imported package name will be used to construct the full
+ * class name, which will then be used to load the class. Inherently, this is less efficient than importing a class.
+ *
* @param packageName The package name to be imported
*/
public void importPackage(String packageName) {
@@ -146,9 +141,9 @@
/**
* Define a bean in the local bean repository
+ *
* @param name The name of the bean
- * @param bean The bean instance to be defined. If null, the definition
- * of the bean is removed.
+ * @param bean The bean instance to be defined. If null, the definition of the bean is removed.
* @return the previous bean (if any) mapped to <code>name</code>
*/
public Object defineBean(String name, Object bean) {
diff --git a/api/src/main/java/javax/el/ELProcessor.java b/api/src/main/java/javax/el/ELProcessor.java
index 587c7fd..9bcbc60 100644
--- a/api/src/main/java/javax/el/ELProcessor.java
+++ b/api/src/main/java/javax/el/ELProcessor.java
@@ -20,52 +20,58 @@
import java.lang.reflect.Modifier;
/**
- * <p>Provides an API for using EL in a stand-alone environment.</p>
+ * <p>
+ * Provides an API for using EL in a stand-alone environment.
+ * </p>
*
- * <p>This class provides a direct and simple interface for
+ * <p>
+ * This class provides a direct and simple interface for
* <ul>
- * <li>Evaluating EL expressions.</li>
- * <li>Assigning values to beans or setting a bean property.</li>
- * <li>Setting a {@link ValueExpression} to a EL variable.</li>
- * <li>Defining a static method as an EL function.</li>
- * <li>Defining an object instance as an EL name.
+ * <li>Evaluating EL expressions.</li>
+ * <li>Assigning values to beans or setting a bean property.</li>
+ * <li>Setting a {@link ValueExpression} to a EL variable.</li>
+ * <li>Defining a static method as an EL function.</li>
+ * <li>Defining an object instance as an EL name.
* </ul>
*
- * <p>This API is not a replacement for the APIs in EL 2.2. Containers that
- * maintains EL environments can continue to do so, without using this API.</p>
+ * <p>
+ * This API is not a replacement for the APIs in EL 2.2. Containers that maintains EL environments can continue to do
+ * so, without using this API.
+ * </p>
*
- * <p>For EL users who want to manipulate EL environments, like adding custom
- * {@link ELResolver}s, {@link ELManager} can be used.</p>
+ * <p>
+ * For EL users who want to manipulate EL environments, like adding custom {@link ELResolver}s, {@link ELManager} can be
+ * used.
+ * </p>
*
* <h3>Scope and Life Cycle</h3>
- * <p>Since it maintains the state of the EL environments,
- * <code>ELProcessor</code> is not thread safe. In the simplest case,
- * an instance can be created and destroyed before and after evaluating
- * EL expressions. A more general usage is to use an instance of
- * <code>ELProcessor</code> for a session, so that the user can configure the
- * EL evaluation environment for that session.</p>
+ * <p>
+ * Since it maintains the state of the EL environments, <code>ELProcessor</code> is not thread safe. In the simplest
+ * case, an instance can be created and destroyed before and after evaluating EL expressions. A more general usage is to
+ * use an instance of <code>ELProcessor</code> for a session, so that the user can configure the EL evaluation
+ * environment for that session.
+ * </p>
*
* <h3>Automatic Bracketing of Expressions</h3>
- * <p>A note about the EL expressions strings used in the class. The strings
- * allowed in the methods {@link ELProcessor#getValue},
- * {@link ELProcessor#setValue}, and {@link ELProcessor#setVariable} are
- * limited to non-composite expressions, i.e. expressions
- * of the form ${...} or #{...} only. Also, it is not necessary (in fact not
- * allowed) to bracket the expression strings with ${ or #{ and } in these
- * methods: they will be automatically bracketed. This reduces the visual
- * cluster, without any lost of functionalities (thanks to the addition of the
+ * <p>
+ * A note about the EL expressions strings used in the class. The strings allowed in the methods
+ * {@link ELProcessor#getValue}, {@link ELProcessor#setValue}, and {@link ELProcessor#setVariable} are limited to
+ * non-composite expressions, i.e. expressions of the form ${...} or #{...} only. Also, it is not necessary (in fact not
+ * allowed) to bracket the expression strings with ${ or #{ and } in these methods: they will be automatically
+ * bracketed. This reduces the visual cluster, without any lost of functionalities (thanks to the addition of the
* concatenation operator).
*
- * <h3>Example</h3>
- * The following code snippet illustrates the use of ELProcessor to define
- * a bean and evaluate its property.
- * <blockquote>
+ * <h3>Example</h3> The following code snippet illustrates the use of ELProcessor to define a bean and evaluate its
+ * property. <blockquote>
+ *
* <pre>
- * ELProcessor elp = new ELProcessor();
- * elp.defineBean("employee", new Employee("Charlie Brown"));
- * String name = elp.eval("employee.name");
+ * ELProcessor elp = new ELProcessor();
+ * elp.defineBean("employee", new Employee("Charlie Brown"));
+ * String name = elp.eval("employee.name");
* </pre>
+ *
* </blockquote>
+ *
* @since EL 3.0
*/
@@ -76,6 +82,7 @@
/**
* Return the ELManager used for EL processing.
+ *
* @return The ELManager used for EL processing.
*/
public ELManager getELManager() {
@@ -84,6 +91,7 @@
/**
* Evaluates an EL expression.
+ *
* @param expression The EL expression to be evaluated.
* @return The result of the expression evaluation.
*/
@@ -93,97 +101,78 @@
/**
* Evaluates an EL expression, and coerces the result to the specified type.
+ *
* @param expression The EL expression to be evaluated.
- * @param expectedType Specifies the type that the resultant evaluation
- * will be coerced to.
+ * @param expectedType Specifies the type that the resultant evaluation will be coerced to.
* @return The result of the expression evaluation.
*/
public Object getValue(String expression, Class<?> expectedType) {
- ValueExpression exp = factory.createValueExpression(
- elManager.getELContext(),
- bracket(expression), expectedType);
+ ValueExpression exp = factory.createValueExpression(elManager.getELContext(), bracket(expression), expectedType);
return exp.getValue(elManager.getELContext());
}
/**
- * Sets an expression with a new value.
- * The target expression is evaluated, up to the last property resolution,
- * and the resultant (base, property) pair is set to the provided value.
+ * Sets an expression with a new value. The target expression is evaluated, up to the last property resolution, and the
+ * resultant (base, property) pair is set to the provided value.
*
* @param expression The target expression
* @param value The new value to set.
- * @throws PropertyNotFoundException if one of the property
- * resolutions failed because a specified variable or property
- * does not exist or is not readable.
- * @throws PropertyNotWritableException if the final variable or
- * property resolution failed because the specified
- * variable or property is not writable.
- * @throws ELException if an exception was thrown while attempting to
- * set the property or variable. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if one of the property resolutions failed because a specified variable or property
+ * does not exist or is not readable.
+ * @throws PropertyNotWritableException if the final variable or property resolution failed because the specified
+ * variable or property is not writable.
+ * @throws ELException if an exception was thrown while attempting to set the property or variable. The thrown exception
+ * must be included as the cause property of this exception, if available.
*/
public void setValue(String expression, Object value) {
- ValueExpression exp = factory.createValueExpression(
- elManager.getELContext(),
- bracket(expression), Object.class);
+ ValueExpression exp = factory.createValueExpression(elManager.getELContext(), bracket(expression), Object.class);
exp.setValue(elManager.getELContext(), value);
}
/**
- * Assign an EL expression to an EL variable. The expression is parsed,
- * but not evaluated, and the parsed expression is mapped to the EL
- * variable in the local variable map.
- * Any previously assigned expression to the same variable will be replaced.
- * If the expression is <code>null</code>, the variable will be removed.
+ * Assign an EL expression to an EL variable. The expression is parsed, but not evaluated, and the parsed expression is
+ * mapped to the EL variable in the local variable map. Any previously assigned expression to the same variable will be
+ * replaced. If the expression is <code>null</code>, the variable will be removed.
+ *
* @param var The name of the variable.
* @param expression The EL expression to be assigned to the variable.
*/
public void setVariable(String var, String expression) {
- ValueExpression exp = factory.createValueExpression(
- elManager.getELContext(),
- bracket(expression), Object.class);
+ ValueExpression exp = factory.createValueExpression(elManager.getELContext(), bracket(expression), Object.class);
elManager.setVariable(var, exp);
}
/**
* Define an EL function in the local function mapper.
+ *
* @param prefix The namespace for the function or "" for no namesapce.
- * @param function The name of the function.
- * If empty (""), the method name is used as the function name.
+ * @param function The name of the function. If empty (""), the method name is used as the function name.
* @param className The full Java class name that implements the function.
- * @param method The name (specified without parenthesis) or the signature
- * (as in the Java Language Spec) of the static method that implements
- * the function. If the name (e.g. "sum") is given, the first declared
- * method in class that matches the name is selected. If the signature
- * (e.g. "int sum(int, int)" ) is given, then the declared method
- * with the signature is selected.
- *
+ * @param method The name (specified without parenthesis) or the signature (as in the Java Language Spec) of the static
+ * method that implements the function. If the name (e.g. "sum") is given, the first declared method in class that
+ * matches the name is selected. If the signature (e.g. "int sum(int, int)" ) is given, then the declared method with
+ * the signature is selected.
+ *
* @throws NullPointerException if any of the arguments is null.
* @throws ClassNotFoundException if the specified class does not exists.
- * @throws NoSuchMethodException if the method (with or without the
- * signature) is not a declared method of the class, or if the method
- * signature is not valid, or if the method is not a static method.
+ * @throws NoSuchMethodException if the method (with or without the signature) is not a declared method of the class, or
+ * if the method signature is not valid, or if the method is not a static method.
*/
- public void defineFunction(String prefix, String function,
- String className,
- String method)
- throws ClassNotFoundException, NoSuchMethodException {
-
- if (prefix == null || function == null || className == null
- || method == null) {
+ public void defineFunction(String prefix, String function, String className, String method) throws ClassNotFoundException, NoSuchMethodException {
+
+ if (prefix == null || function == null || className == null || method == null) {
throw new NullPointerException("Null argument for defineFunction");
}
-
+
Method meth = null;
ClassLoader loader = Thread.currentThread().getContextClassLoader();
- if(loader == null)
+ if (loader == null)
loader = getClass().getClassLoader();
Class<?> klass = Class.forName(className, false, loader);
int j = method.indexOf('(');
if (j < 0) {
// Just a name is given
- for (Method m: klass.getDeclaredMethods()) {
+ for (Method m : klass.getDeclaredMethods()) {
if (m.getName().equals(method)) {
meth = m;
}
@@ -196,24 +185,22 @@
// First get the method name, ignore the return type
int p = method.indexOf(' ');
if (p < 0) {
- throw new NoSuchMethodException(
- "Bad method singnature: " + method);
+ throw new NoSuchMethodException("Bad method singnature: " + method);
}
- String methodName = method.substring(p+1, j).trim();
+ String methodName = method.substring(p + 1, j).trim();
// Extract parameter types
- p = method.indexOf(')', j+1);
+ p = method.indexOf(')', j + 1);
if (p < 0) {
- throw new NoSuchMethodException(
- "Bad method singnature: " + method);
+ throw new NoSuchMethodException("Bad method singnature: " + method);
}
- String[] params = method.substring(j+1, p).split(",");
+ String[] params = method.substring(j + 1, p).split(",");
Class<?>[] paramTypes = new Class<?>[params.length];
for (int i = 0; i < params.length; i++) {
paramTypes[i] = toClass(params[i], loader);
}
meth = klass.getDeclaredMethod(methodName, paramTypes);
}
- if (! Modifier.isStatic(meth.getModifiers())) {
+ if (!Modifier.isStatic(meth.getModifiers())) {
throw new NoSuchMethodException("The method specified in defineFunction must be static: " + meth);
}
if (function.equals("")) {
@@ -224,51 +211,47 @@
/**
* Define an EL function in the local function mapper.
+ *
* @param prefix The namespace for the function or "" for no namesapce.
- * @param function The name of the function.
- * If empty (""), the method name is used as the function name.
- * @param method The <code>java.lang.reflect.Method</code> instance of
- * the method that implements the function.
+ * @param function The name of the function. If empty (""), the method name is used as the function name.
+ * @param method The <code>java.lang.reflect.Method</code> instance of the method that implements the function.
* @throws NullPointerException if any of the arguments is null.
* @throws NoSuchMethodException if the method is not a static method
*/
- public void defineFunction(String prefix, String function, Method method)
- throws NoSuchMethodException {
+ public void defineFunction(String prefix, String function, Method method) throws NoSuchMethodException {
if (prefix == null || function == null || method == null) {
throw new NullPointerException("Null argument for defineFunction");
}
- if (! Modifier.isStatic(method.getModifiers())) {
+ if (!Modifier.isStatic(method.getModifiers())) {
throw new NoSuchMethodException("The method specified in defineFunction must be static: " + method);
}
if (function.equals("")) {
function = method.getName();
- }
+ }
elManager.mapFunction(prefix, function, method);
}
/**
- * Define a bean in a local bean repository, hiding other beans of the
- * same name.
+ * Define a bean in a local bean repository, hiding other beans of the same name.
+ *
* @param name The name of the bean
- * @param bean The bean instance to be defined. If <code>null</code>,
- * the name will be removed from the local bean repository.
+ * @param bean The bean instance to be defined. If <code>null</code>, the name will be removed from the local bean
+ * repository.
*/
public void defineBean(String name, Object bean) {
elManager.defineBean(name, bean);
}
/**
- * Return the Class object associated with the class or interface with
- * the given name.
+ * Return the Class object associated with the class or interface with the given name.
*/
- private static Class<?> toClass(String type, ClassLoader loader)
- throws ClassNotFoundException {
+ private static Class<?> toClass(String type, ClassLoader loader) throws ClassNotFoundException {
Class<?> c = null;
int i0 = type.indexOf('[');
int dims = 0;
if (i0 > 0) {
- // This is an array. Count the dimensions
+ // This is an array. Count the dimensions
for (int i = 0; i < type.length(); i++) {
if (type.charAt(i) == '[')
dims++;
@@ -281,7 +264,7 @@
else if ("char".equals(type))
c = char.class;
else if ("byte".equals(type))
- c = byte.class;
+ c = byte.class;
else if ("short".equals(type))
c = short.class;
else if ("int".equals(type))
@@ -309,4 +292,3 @@
return "${" + expression + '}';
}
}
-
diff --git a/api/src/main/java/javax/el/ELResolver.java b/api/src/main/java/javax/el/ELResolver.java
index 62300b7..6cf4b9e 100644
--- a/api/src/main/java/javax/el/ELResolver.java
+++ b/api/src/main/java/javax/el/ELResolver.java
@@ -21,77 +21,73 @@
import java.util.Iterator;
/**
- * Enables customization of variable, property, method call, and type
- * conversion resolution behavior for EL expression evaluation.
+ * Enables customization of variable, property, method call, and type conversion resolution behavior for EL expression
+ * evaluation.
*
- * <p>While evaluating an expression, the <code>ELResolver</code> associated
- * with the {@link ELContext} is consulted to do the initial resolution of
- * the first variable of an expression. It is also consulted when a
- * <code>.</code> or <code>[]</code> operator is encountered.
+ * <p>
+ * While evaluating an expression, the <code>ELResolver</code> associated with the {@link ELContext} is consulted to do
+ * the initial resolution of the first variable of an expression. It is also consulted when a <code>.</code> or
+ * <code>[]</code> operator is encountered.
*
- * <p>For example, in the EL expression <code>${employee.lastName}</code>,
- * the <code>ELResolver</code> determines what object <code>employee</code>
- * refers to, and what it means to get the <code>lastName</code> property on
- * that object.</p>
+ * <p>
+ * For example, in the EL expression <code>${employee.lastName}</code>, the <code>ELResolver</code> determines what
+ * object <code>employee</code> refers to, and what it means to get the <code>lastName</code> property on that object.
+ * </p>
*
- * <p>Most methods in this class accept a <code>base</code>
- * and <code>property</code> parameter. In the case of variable resolution
- * (e.g. determining what <code>employee</code> refers to in
- * <code>${employee.lastName}</code>), the <code>base</code> parameter will
- * be <code>null</code> and the <code>property</code> parameter will always
- * be of type <code>String</code>. In this case, if the <code>property</code>
- * is not a <code>String</code>, the behavior of the <code>ELResolver</code>
- * is undefined.</p>
+ * <p>
+ * Most methods in this class accept a <code>base</code> and <code>property</code> parameter. In the case of variable
+ * resolution (e.g. determining what <code>employee</code> refers to in <code>${employee.lastName}</code>), the
+ * <code>base</code> parameter will be <code>null</code> and the <code>property</code> parameter will always be of type
+ * <code>String</code>. In this case, if the <code>property</code> is not a <code>String</code>, the behavior of the
+ * <code>ELResolver</code> is undefined.
+ * </p>
*
- * <p>In the case of property resolution, the <code>base</code> parameter
- * identifies the base object and the <code>property</code> object identifies
- * the property on that base. For example, in the expression
- * <code>${employee.lastName}</code>, <code>base</code> is the result of the
- * variable resolution for <code>employee</code> and <code>property</code>
- * is the string <code>"lastName"</code>. In the expression
- * <code>${y[x]}</code>, <code>base</code> is the result of the variable
- * resolution for <code>y</code> and <code>property</code> is the result of
- * the variable resolution for <code>x</code>.</p>
+ * <p>
+ * In the case of property resolution, the <code>base</code> parameter identifies the base object and the
+ * <code>property</code> object identifies the property on that base. For example, in the expression
+ * <code>${employee.lastName}</code>, <code>base</code> is the result of the variable resolution for
+ * <code>employee</code> and <code>property</code> is the string <code>"lastName"</code>. In the expression
+ * <code>${y[x]}</code>, <code>base</code> is the result of the variable resolution for <code>y</code> and
+ * <code>property</code> is the result of the variable resolution for <code>x</code>.
+ * </p>
*
- * <p>In the case of method call resolution, the <code>base</code> parameter
- * identifies the base object and the <code>method</code> parameter identifies
- * a method on that base. In the case of overloaded methods, the <code>
- * paramTypes</code> parameter can be optionally used to identify a method.
- * The <code>params</code>parameter are the parameters for the method call,
- * and can also be used for resolving overloaded methods when the
+ * <p>
+ * In the case of method call resolution, the <code>base</code> parameter identifies the base object and the
+ * <code>method</code> parameter identifies a method on that base. In the case of overloaded methods, the <code>
+ * paramTypes</code> parameter can be optionally used to identify a method. The <code>params</code>parameter are the
+ * parameters for the method call, and can also be used for resolving overloaded methods when the
* <code>paramTypes</code> parameter is not specified.
*
- * <p>In the case of type conversion resolution, the <code>obj</code> parameter
- * identifies the source object and the <code>targetType</code> parameter
- * identifies the target type the source to covert to.
+ * <p>
+ * In the case of type conversion resolution, the <code>obj</code> parameter identifies the source object and the
+ * <code>targetType</code> parameter identifies the target type the source to covert to.
*
- * <p>Though only a single <code>ELResolver</code> is associated with an
- * <code>ELContext</code>, there are usually multiple resolvers considered
- * for any given variable or property resolution. <code>ELResolver</code>s
- * are combined together using {@link CompositeELResolver}s, to define
- * rich semantics for evaluating an expression.</p>
+ * <p>
+ * Though only a single <code>ELResolver</code> is associated with an <code>ELContext</code>, there are usually multiple
+ * resolvers considered for any given variable or property resolution. <code>ELResolver</code>s are combined together
+ * using {@link CompositeELResolver}s, to define rich semantics for evaluating an expression.
+ * </p>
*
- * <p>For the {@link #getValue}, {@link #getType}, {@link #setValue}, and
- * {@link #isReadOnly} methods, an <code>ELResolver</code> is not
- * responsible for resolving all possible (base, property) pairs. In fact,
- * most resolvers will only handle a <code>base</code> of a single type.
- * To indicate that a resolver has successfully resolved a particular
- * (base, property) pair, it must set the <code>propertyResolved</code>
- * property of the <code>ELContext</code> to <code>true</code>. If it could
- * not handle the given pair, it must leave this property alone. The caller
- * must ignore the return value of the method if <code>propertyResolved</code>
- * is <code>false</code>.</p>
+ * <p>
+ * For the {@link #getValue}, {@link #getType}, {@link #setValue}, and {@link #isReadOnly} methods, an
+ * <code>ELResolver</code> is not responsible for resolving all possible (base, property) pairs. In fact, most resolvers
+ * will only handle a <code>base</code> of a single type. To indicate that a resolver has successfully resolved a
+ * particular (base, property) pair, it must set the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> to <code>true</code>. If it could not handle the given pair, it must leave this property
+ * alone. The caller must ignore the return value of the method if <code>propertyResolved</code> is <code>false</code>.
+ * </p>
*
- * <p>Similarly, for the {@link #convertToType} method an
- * <code>ELResolver</code>
- * must set the <code>propertyResolved</code> to <code>true</code> to indicate
- * that it handles the conversion of the object to the target type.</p>
+ * <p>
+ * Similarly, for the {@link #convertToType} method an <code>ELResolver</code> must set the
+ * <code>propertyResolved</code> to <code>true</code> to indicate that it handles the conversion of the object to the
+ * target type.
+ * </p>
*
- * <p>The {@link #getFeatureDescriptors} and {@link #getCommonPropertyType}
- * methods are primarily designed for design-time tool support, but must
- * handle invocation at runtime as well. The
- * {@link java.beans.Beans#isDesignTime} method can be used to determine
- * if the resolver is being consulted at design-time or runtime.</p>
+ * <p>
+ * The {@link #getFeatureDescriptors} and {@link #getCommonPropertyType} methods are primarily designed for design-time
+ * tool support, but must handle invocation at runtime as well. The {@link java.beans.Beans#isDesignTime} method can be
+ * used to determine if the resolver is being consulted at design-time or runtime.
+ * </p>
*
* @see CompositeELResolver
* @see ELContext#getELResolver
@@ -102,303 +98,234 @@
// --------------------------------------------------------- Constants
/**
- * <p>The attribute name of the named attribute in the
- * <code>FeatureDescriptor</code> that specifies the runtime type of
- * the variable or property.</p>
+ * <p>
+ * The attribute name of the named attribute in the <code>FeatureDescriptor</code> that specifies the runtime type of
+ * the variable or property.
+ * </p>
*/
public static final String TYPE = "type";
/**
- * <p>The attribute name of the named attribute in the
- * <code>FeatureDescriptor</code> that specifies whether the
- * variable or property can be resolved at runtime.</p>
+ * <p>
+ * The attribute name of the named attribute in the <code>FeatureDescriptor</code> that specifies whether the variable
+ * or property can be resolved at runtime.
+ * </p>
*/
public static final String RESOLVABLE_AT_DESIGN_TIME = "resolvableAtDesignTime";
/**
- * Attempts to resolve the given <code>property</code> object on the given
- * <code>base</code> object.
+ * Attempts to resolve the given <code>property</code> object on the given <code>base</code> object.
*
- * <p>If this resolver handles the given (base, property) pair,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller should ignore
- * the return value.</p>
+ * <p>
+ * If this resolver handles the given (base, property) pair, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller should ignore the return value.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The base object whose property value is to be returned,
- * or <code>null</code> to resolve a top-level variable.
+ * @param base The base object whose property value is to be returned, or <code>null</code> to resolve a top-level
+ * variable.
* @param property The property or variable to be resolved.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the result of the variable or property resolution; otherwise
- * undefined.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the result of the variable or property resolution; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if the given (base, property) pair
- * is handled by this <code>ELResolver</code> but the specified
- * variable or property does not exist or is not readable.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if the given (base, property) pair is handled by this <code>ELResolver</code> but
+ * the specified variable or property does not exist or is not readable.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public abstract Object getValue(ELContext context,
- Object base,
- Object property);
+ public abstract Object getValue(ELContext context, Object base, Object property);
/**
- * Attempts to resolve and invoke the given <code>method</code> on the given
- * <code>base</code> object.
+ * Attempts to resolve and invoke the given <code>method</code> on the given <code>base</code> object.
*
- * <p>If this resolver handles the given (base, method) pair,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller should ignore
- * the return value.</p>
+ * <p>
+ * If this resolver handles the given (base, method) pair, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>A default implementation is provided that returns null so that
- * existing classes that extend ELResolver can continue to function.</p>
+ * <p>
+ * A default implementation is provided that returns null so that existing classes that extend ELResolver can continue
+ * to function.
+ * </p>
*
* @param context The context of this evaluation.
* @param base The bean on which to invoke the method
- * @param method The simple name of the method to invoke.
- * Will be coerced to a <code>String</code>.
- * @param paramTypes An array of Class objects identifying the
- * method's formal parameter types, in declared order.
- * Use an empty array if the method has no parameters.
- * Can be <code>null</code>, in which case the method's formal
- * parameter types are assumed to be unknown.
- * @param params The parameters to pass to the method, or
- * <code>null</code> if no parameters.
- * @return The result of the method invocation (<code>null</code> if
- * the method has a <code>void</code> return type).
+ * @param method The simple name of the method to invoke. Will be coerced to a <code>String</code>.
+ * @param paramTypes An array of Class objects identifying the method's formal parameter types, in declared order. Use
+ * an empty array if the method has no parameters. Can be <code>null</code>, in which case the method's formal parameter
+ * types are assumed to be unknown.
+ * @param params The parameters to pass to the method, or <code>null</code> if no parameters.
+ * @return The result of the method invocation (<code>null</code> if the method has a <code>void</code> return type).
* @throws MethodNotFoundException if no suitable method can be found.
- * @throws ELException if an exception was thrown while performing
- * (base, method) resolution. The thrown exception must be
- * included as the cause property of this exception, if
- * available. If the exception thrown is an
- * <code>InvocationTargetException</code>, extract its
- * <code>cause</code> and pass it to the
- * <code>ELException</code> constructor.
+ * @throws ELException if an exception was thrown while performing (base, method) resolution. The thrown exception must
+ * be included as the cause property of this exception, if available. If the exception thrown is an
+ * <code>InvocationTargetException</code>, extract its <code>cause</code> and pass it to the <code>ELException</code>
+ * constructor.
* @since EL 2.2
*/
- public Object invoke(ELContext context,
- Object base,
- Object method,
- Class<?>[] paramTypes,
- Object[] params) {
+ public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) {
return null;
}
-
/**
- * For a given <code>base</code> and <code>property</code>, attempts to
- * identify the most general type that is acceptable for an object to be
- * passed as the <code>value</code> parameter in a future call
- * to the {@link #setValue} method.
+ * For a given <code>base</code> and <code>property</code>, attempts to identify the most general type that is
+ * acceptable for an object to be passed as the <code>value</code> parameter in a future call to the {@link #setValue}
+ * method.
*
- * <p>If this resolver handles the given (base, property) pair,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller should ignore
- * the return value.</p>
+ * <p>
+ * If this resolver handles the given (base, property) pair, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>This is not always the same as <code>getValue().getClass()</code>.
- * For example, in the case of an {@link ArrayELResolver}, the
- * <code>getType</code> method will return the element type of the
- * array, which might be a superclass of the type of the actual
- * element that is currently in the specified array element.</p>
+ * <p>
+ * This is not always the same as <code>getValue().getClass()</code>. For example, in the case of an
+ * {@link ArrayELResolver}, the <code>getType</code> method will return the element type of the array, which might be a
+ * superclass of the type of the actual element that is currently in the specified array element.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The base object whose property value is to be analyzed,
- * or <code>null</code> to analyze a top-level variable.
- * @param property The property or variable to return the acceptable
- * type for.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the most general acceptable type; otherwise undefined.
- * @throws PropertyNotFoundException if the given (base, property) pair
- * is handled by this <code>ELResolver</code> but the specified
- * variable or property does not exist or is not readable.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @param base The base object whose property value is to be analyzed, or <code>null</code> to analyze a top-level
+ * variable.
+ * @param property The property or variable to return the acceptable type for.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the most general acceptable type; otherwise undefined.
+ * @throws PropertyNotFoundException if the given (base, property) pair is handled by this <code>ELResolver</code> but
+ * the specified variable or property does not exist or is not readable.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public abstract Class<?> getType(ELContext context,
- Object base,
- Object property);
+ public abstract Class<?> getType(ELContext context, Object base, Object property);
/**
- * Attempts to set the value of the given <code>property</code>
- * object on the given <code>base</code> object.
+ * Attempts to set the value of the given <code>property</code> object on the given <code>base</code> object.
*
- * <p>If this resolver handles the given (base, property) pair,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller can
- * safely assume no value has been set.</p>
+ * <p>
+ * If this resolver handles the given (base, property) pair, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller can safely assume no value has been set.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The base object whose property value is to be set,
- * or <code>null</code> to set a top-level variable.
+ * @param base The base object whose property value is to be set, or <code>null</code> to set a top-level variable.
* @param property The property or variable to be set.
* @param value The value to set the property or variable to.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if the given (base, property) pair
- * is handled by this <code>ELResolver</code> but the specified
- * variable or property does not exist.
- * @throws PropertyNotWritableException if the given (base, property)
- * pair is handled by this <code>ELResolver</code> but the specified
- * variable or property is not writable.
- * @throws ELException if an exception was thrown while attempting to
- * set the property or variable. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if the given (base, property) pair is handled by this <code>ELResolver</code> but
+ * the specified variable or property does not exist.
+ * @throws PropertyNotWritableException if the given (base, property) pair is handled by this <code>ELResolver</code>
+ * but the specified variable or property is not writable.
+ * @throws ELException if an exception was thrown while attempting to set the property or variable. The thrown exception
+ * must be included as the cause property of this exception, if available.
*/
- public abstract void setValue(ELContext context,
- Object base,
- Object property,
- Object value);
-
+ public abstract void setValue(ELContext context, Object base, Object property, Object value);
/**
- * For a given <code>base</code> and <code>property</code>, attempts to
- * determine whether a call to {@link #setValue} will always fail.
+ * For a given <code>base</code> and <code>property</code>, attempts to determine whether a call to {@link #setValue}
+ * will always fail.
*
- * <p>If this resolver handles the given (base, property) pair,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller should ignore
- * the return value.</p>
+ * <p>
+ * If this resolver handles the given (base, property) pair, the <code>propertyResolved</code> property of the
+ * <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is
+ * not <code>true</code> after this method is called, the caller should ignore the return value.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The base object whose property value is to be analyzed,
- * or <code>null</code> to analyze a top-level variable.
- * @param property The property or variable to return the read-only status
- * for.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * <code>true</code> if the property is read-only or
- * <code>false</code> if not; otherwise undefined.
+ * @param base The base object whose property value is to be analyzed, or <code>null</code> to analyze a top-level
+ * variable.
+ * @param property The property or variable to return the read-only status for.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * <code>true</code> if the property is read-only or <code>false</code> if not; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if the given (base, property) pair
- * is handled by this <code>ELResolver</code> but the specified
- * variable or property does not exist.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if the given (base, property) pair is handled by this <code>ELResolver</code> but
+ * the specified variable or property does not exist.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public abstract boolean isReadOnly(ELContext context,
- Object base,
- Object property);
+ public abstract boolean isReadOnly(ELContext context, Object base, Object property);
/**
- * Returns information about the set of variables or properties that
- * can be resolved for the given <code>base</code> object. One use for
- * this method is to assist tools in auto-completion.
+ * Returns information about the set of variables or properties that can be resolved for the given <code>base</code>
+ * object. One use for this method is to assist tools in auto-completion.
*
- * <p>If the <code>base</code> parameter is <code>null</code>, the
- * resolver must enumerate the list of top-level variables it can
- * resolve.</p>
+ * <p>
+ * If the <code>base</code> parameter is <code>null</code>, the resolver must enumerate the list of top-level variables
+ * it can resolve.
+ * </p>
*
- * <p>The <code>Iterator</code> returned must contain zero or more
- * instances of {@link java.beans.FeatureDescriptor}, in no guaranteed
- * order. In the case of primitive types such as <code>int</code>, the
- * value <code>null</code> must be returned. This is to prevent the
- * useless iteration through all possible primitive values. A
- * return value of <code>null</code> indicates that this resolver does
- * not handle the given <code>base</code> object or that the results
- * are too complex to represent with this method and the
- * {@link #getCommonPropertyType} method should be used instead.</p>
+ * <p>
+ * The <code>Iterator</code> returned must contain zero or more instances of {@link java.beans.FeatureDescriptor}, in no
+ * guaranteed order. In the case of primitive types such as <code>int</code>, the value <code>null</code> must be
+ * returned. This is to prevent the useless iteration through all possible primitive values. A return value of
+ * <code>null</code> indicates that this resolver does not handle the given <code>base</code> object or that the results
+ * are too complex to represent with this method and the {@link #getCommonPropertyType} method should be used instead.
+ * </p>
*
- * <p>Each <code>FeatureDescriptor</code> will contain information about
- * a single variable or property. In addition to the standard
- * properties, the <code>FeatureDescriptor</code> must have two
- * named attributes (as set by the <code>setValue</code> method):
+ * <p>
+ * Each <code>FeatureDescriptor</code> will contain information about a single variable or property. In addition to the
+ * standard properties, the <code>FeatureDescriptor</code> must have two named attributes (as set by the
+ * <code>setValue</code> method):
* <ul>
- * <li>{@link #TYPE} - The value of this named attribute must be
- * an instance of <code>java.lang.Class</code> and specify the
- * runtime type of the variable or property.</li>
- * <li>{@link #RESOLVABLE_AT_DESIGN_TIME} - The value of this
- * named attribute must be an instance of
- * <code>java.lang.Boolean</code> and indicates whether it is safe
- * to attempt to resolve this property at design-time. For
- * instance, it may be unsafe to attempt a resolution at design
- * time if the <code>ELResolver</code> needs access to a resource
- * that is only available at runtime and no acceptable simulated
- * value can be provided.</li>
+ * <li>{@link #TYPE} - The value of this named attribute must be an instance of <code>java.lang.Class</code> and specify
+ * the runtime type of the variable or property.</li>
+ * <li>{@link #RESOLVABLE_AT_DESIGN_TIME} - The value of this named attribute must be an instance of
+ * <code>java.lang.Boolean</code> and indicates whether it is safe to attempt to resolve this property at design-time.
+ * For instance, it may be unsafe to attempt a resolution at design time if the <code>ELResolver</code> needs access to
+ * a resource that is only available at runtime and no acceptable simulated value can be provided.</li>
* </ul>
*
- * <p>The caller should be aware that the <code>Iterator</code>
- * returned might iterate through a very large or even infinitely large
- * set of properties. Care should be taken by the caller to not get
- * stuck in an infinite loop.
+ * <p>
+ * The caller should be aware that the <code>Iterator</code> returned might iterate through a very large or even
+ * infinitely large set of properties. Care should be taken by the caller to not get stuck in an infinite loop.
*
- * <p>This is a "best-effort" list. Not all <code>ELResolver</code>s
- * will return completely accurate results, but all must be callable
- * at both design-time and runtime (i.e. whether or not
- * <code>Beans.isDesignTime()</code> returns <code>true</code>),
- * without causing errors.
+ * <p>
+ * This is a "best-effort" list. Not all <code>ELResolver</code>s will return completely accurate results, but all must
+ * be callable at both design-time and runtime (i.e. whether or not <code>Beans.isDesignTime()</code> returns
+ * <code>true</code>), without causing errors.
*
- * <p>The <code>propertyResolved</code> property of the
- * <code>ELContext</code> is not relevant to this method.
- * The results of all <code>ELResolver</code>s are concatenated
- * in the case of composite resolvers.
+ * <p>
+ * The <code>propertyResolved</code> property of the <code>ELContext</code> is not relevant to this method. The results
+ * of all <code>ELResolver</code>s are concatenated in the case of composite resolvers.
*
* @param context The context of this evaluation.
- * @param base The base object whose set of valid properties is to
- * be enumerated, or <code>null</code> to enumerate the set of
- * top-level variables that this resolver can evaluate.
- * @return An <code>Iterator</code> containing zero or more (possibly
- * infinitely more) <code>FeatureDescriptor</code> objects, or
- * <code>null</code> if this resolver does not handle the given
- * <code>base</code> object or that the results are too complex to
- * represent with this method
+ * @param base The base object whose set of valid properties is to be enumerated, or <code>null</code> to enumerate the
+ * set of top-level variables that this resolver can evaluate.
+ * @return An <code>Iterator</code> containing zero or more (possibly infinitely more) <code>FeatureDescriptor</code>
+ * objects, or <code>null</code> if this resolver does not handle the given <code>base</code> object or that the results
+ * are too complex to represent with this method
* @see java.beans.FeatureDescriptor
*/
- public abstract Iterator<FeatureDescriptor> getFeatureDescriptors(
- ELContext context,
- Object base);
+ public abstract Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base);
/**
- * Returns the most general type that this resolver accepts for the
- * <code>property</code> argument, given a <code>base</code> object.
- * One use for this method is to assist tools in auto-completion.
+ * Returns the most general type that this resolver accepts for the <code>property</code> argument, given a
+ * <code>base</code> object. One use for this method is to assist tools in auto-completion.
*
- * <p>This assists tools in auto-completion and also provides a
- * way to express that the resolver accepts a primitive value,
- * such as an integer index into an array. For example, the
- * {@link ArrayELResolver} will accept any <code>int</code> as a
- * <code>property</code>, so the return value would be
- * <code>Integer.class</code>.</p>
+ * <p>
+ * This assists tools in auto-completion and also provides a way to express that the resolver accepts a primitive value,
+ * such as an integer index into an array. For example, the {@link ArrayELResolver} will accept any <code>int</code> as
+ * a <code>property</code>, so the return value would be <code>Integer.class</code>.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The base object to return the most general property
- * type for, or <code>null</code> to enumerate the set of
- * top-level variables that this resolver can evaluate.
- * @return <code>null</code> if this <code>ELResolver</code> does not
- * know how to handle the given <code>base</code> object; otherwise
- * <code>Object.class</code> if any type of <code>property</code>
- * is accepted; otherwise the most general <code>property</code>
- * type accepted for the given <code>base</code>.
+ * @param base The base object to return the most general property type for, or <code>null</code> to enumerate the set
+ * of top-level variables that this resolver can evaluate.
+ * @return <code>null</code> if this <code>ELResolver</code> does not know how to handle the given <code>base</code>
+ * object; otherwise <code>Object.class</code> if any type of <code>property</code> is accepted; otherwise the most
+ * general <code>property</code> type accepted for the given <code>base</code>.
*/
- public abstract Class<?> getCommonPropertyType(ELContext context,
- Object base);
+ public abstract Class<?> getCommonPropertyType(ELContext context, Object base);
/**
* Converts an object to a specific type.
*
- * <p>An <code>ELException</code> is thrown if an error occurs during
- * the conversion.</p>
+ * <p>
+ * An <code>ELException</code> is thrown if an error occurs during the conversion.
+ * </p>
*
* @param context The context of this evaluation.
* @param obj The object to convert.
@@ -406,9 +333,7 @@
* @return object converted to <code>targetType</code>
* @throws ELException thrown if errors occur.
*/
- public Object convertToType(ELContext context,
- Object obj,
- Class<?> targetType) {
+ public Object convertToType(ELContext context, Object obj, Class<?> targetType) {
return null;
}
}
diff --git a/api/src/main/java/javax/el/ELUtil.java b/api/src/main/java/javax/el/ELUtil.java
index 65751b3..e8056c3 100644
--- a/api/src/main/java/javax/el/ELUtil.java
+++ b/api/src/main/java/javax/el/ELUtil.java
@@ -34,52 +34,52 @@
/**
*
- * <p>Utility methods for this portion of the EL implementation</p>
+ * <p>
+ * Utility methods for this portion of the EL implementation
+ * </p>
*
- * <p>Methods on this class use a Map instance stored in ThreadLocal storage
- * to minimize the performance impact on operations that take place multiple
- * times on a single Thread. The keys and values of the Map
- * are implementation private.</p>
+ * <p>
+ * Methods on this class use a Map instance stored in ThreadLocal storage to minimize the performance impact on
+ * operations that take place multiple times on a single Thread. The keys and values of the Map are implementation
+ * private.
+ * </p>
*
* @author edburns
* @author Kin-man Chung
* @author Dongbin Nie
*/
class ELUtil {
-
- /**
- * <p>This class may not be constructed.</p>
- */
-
- private ELUtil() {
- }
-
-/* For testing Backward Compatibility option
- static java.util.Properties properties = new java.util.Properties();
- static {
- properties.setProperty("javax.el.bc2.2", "true");
- }
-*/
- public static ExpressionFactory exprFactory =
- ExpressionFactory.newInstance(/*properties*/);
/**
- * <p>The <code>ThreadLocal</code> variable used to record the
- * {@link javax.faces.context.FacesContext} instance for each
- * processing thread.</p>
+ * <p>
+ * This class may not be constructed.
+ * </p>
*/
- private static ThreadLocal<Map<String, ResourceBundle>> instance =
- new ThreadLocal<Map<String, ResourceBundle>>() {
- protected Map<String, ResourceBundle> initialValue() {
- return (null);
- }
- };
-
+
+ private ELUtil() {
+ }
+
+ /*
+ * For testing Backward Compatibility option static java.util.Properties properties = new java.util.Properties(); static
+ * { properties.setProperty("javax.el.bc2.2", "true"); }
+ */
+ public static ExpressionFactory exprFactory = ExpressionFactory.newInstance(/* properties */);
+
/**
- * @return a Map stored in ThreadLocal storage. This may
- * be used by methods of this class to minimize the performance
- * impact for operations that may take place multiple times on a given
- * Thread instance.
+ * <p>
+ * The <code>ThreadLocal</code> variable used to record the {@link javax.faces.context.FacesContext} instance for each
+ * processing thread.
+ * </p>
+ */
+ private static ThreadLocal<Map<String, ResourceBundle>> instance = new ThreadLocal<Map<String, ResourceBundle>>() {
+ protected Map<String, ResourceBundle> initialValue() {
+ return (null);
+ }
+ };
+
+ /**
+ * @return a Map stored in ThreadLocal storage. This may be used by methods of this class to minimize the performance
+ * impact for operations that may take place multiple times on a given Thread instance.
*/
private static Map<String, ResourceBundle> getCurrentInstance() {
@@ -91,9 +91,11 @@
return result;
}
-
+
/**
- * <p>Replace the Map with the argument context.</p>
+ * <p>
+ * Replace the Map with the argument context.
+ * </p>
*
* @param context the Map to be stored in ThreadLocal storage.
*/
@@ -103,41 +105,33 @@
instance.set(context);
}
-
+
/*
- * <p>Convenience method, calls through to
- * {@link #getExceptionMessageString(javax.el.ELContext,java.lang.String,Object []).
- * </p>
+ * <p>Convenience method, calls through to {@link #getExceptionMessageString(javax.el.ELContext,java.lang.String,Object
+ * []). </p>
*
- * @param context the ELContext from which the Locale for this message
- * is extracted.
+ * @param context the ELContext from which the Locale for this message is extracted.
*
* @param messageId the messageId String in the ResourceBundle
*
* @return a localized String for the argument messageId
*/
-
+
public static String getExceptionMessageString(ELContext context, String messageId) {
return getExceptionMessageString(context, messageId, null);
- }
-
+ }
+
/*
- * <p>Return a Localized message String suitable for use as an Exception message.
- * Examine the argument <code>context</code> for a <code>Locale</code>. If
- * not present, use <code>Locale.getDefault()</code>. Load the
- * <code>ResourceBundle</code> "javax.el.Messages" using that locale. Get
- * the message string for argument <code>messageId</code>. If not found
- * return "Missing Resource in EL implementation ??? messageId ???"
- * with messageId substituted with the runtime
- * value of argument <code>messageId</code>. If found, and argument
- * <code>params</code> is non-null, format the message using the
- * params. If formatting fails, return a sensible message including
- * the <code>messageId</code>. If argument <code>params</code> is
- * <code>null</code>, skip formatting and return the message directly, otherwise
- * return the formatted message.</p>
+ * <p>Return a Localized message String suitable for use as an Exception message. Examine the argument
+ * <code>context</code> for a <code>Locale</code>. If not present, use <code>Locale.getDefault()</code>. Load the
+ * <code>ResourceBundle</code> "javax.el.Messages" using that locale. Get the message string for argument
+ * <code>messageId</code>. If not found return "Missing Resource in EL implementation ??? messageId ???" with messageId
+ * substituted with the runtime value of argument <code>messageId</code>. If found, and argument <code>params</code> is
+ * non-null, format the message using the params. If formatting fails, return a sensible message including the
+ * <code>messageId</code>. If argument <code>params</code> is <code>null</code>, skip formatting and return the message
+ * directly, otherwise return the formatted message.</p>
*
- * @param context the ELContext from which the Locale for this message
- * is extracted.
+ * @param context the ELContext from which the Locale for this message is extracted.
*
* @param messageId the messageId String in the ResourceBundle
*
@@ -145,27 +139,23 @@
*
* @return a localized String for the argument messageId
*/
-
- public static String getExceptionMessageString(ELContext context,
- String messageId,
- Object [] params) {
+
+ public static String getExceptionMessageString(ELContext context, String messageId, Object[] params) {
String result = "";
Locale locale = null;
-
+
if (null == context || null == messageId) {
return result;
}
-
+
if (null == (locale = context.getLocale())) {
locale = Locale.getDefault();
}
if (null != locale) {
Map<String, ResourceBundle> threadMap = getCurrentInstance();
ResourceBundle rb = null;
- if (null == (rb = (ResourceBundle)
- threadMap.get(locale.toString()))) {
- rb = ResourceBundle.getBundle("javax.el.PrivateMessages",
- locale);
+ if (null == (rb = (ResourceBundle) threadMap.get(locale.toString()))) {
+ rb = ResourceBundle.getBundle("javax.el.PrivateMessages", locale);
threadMap.put(locale.toString(), rb);
}
if (null != rb) {
@@ -183,22 +173,19 @@
}
}
}
-
+
return result;
}
static ExpressionFactory getExpressionFactory() {
return exprFactory;
}
-
- static Constructor<?> findConstructor(Class<?> klass,
- Class<?>[] paramTypes,
- Object[] params) {
+
+ static Constructor<?> findConstructor(Class<?> klass, Class<?>[] paramTypes, Object[] params) {
String methodName = "<init>";
if (klass == null) {
- throw new MethodNotFoundException("Method not found: "
- + klass + "." + methodName + "(" + paramString(paramTypes) + ")");
+ throw new MethodNotFoundException("Method not found: " + klass + "." + methodName + "(" + paramString(paramTypes) + ")");
}
if (paramTypes == null) {
@@ -209,8 +196,7 @@
List<Wrapper> wrappers = Wrapper.wrap(constructors);
- Wrapper result = findWrapper(
- klass, wrappers, methodName, paramTypes, params);
+ Wrapper result = findWrapper(klass, wrappers, methodName, paramTypes, params);
if (result == null) {
return null;
@@ -218,47 +204,37 @@
return getConstructor(klass, (Constructor<?>) result.unWrap());
}
- static Object invokeConstructor(ELContext context,
- Constructor<?> c,
- Object[] params) {
- Object[] parameters = buildParameters(
- context, c.getParameterTypes(), c.isVarArgs(), params);;
+ static Object invokeConstructor(ELContext context, Constructor<?> c, Object[] params) {
+ Object[] parameters = buildParameters(context, c.getParameterTypes(), c.isVarArgs(), params);
+ ;
try {
return c.newInstance(parameters);
} catch (IllegalAccessException iae) {
throw new ELException(iae);
} catch (IllegalArgumentException iae) {
throw new ELException(iae);
- } catch (InvocationTargetException ite) {
+ } catch (InvocationTargetException ite) {
throw new ELException(ite.getCause());
} catch (InstantiationException ie) {
throw new ELException(ie.getCause());
}
}
- static Method findMethod(Class<?> klass,
- String method,
- Class<?>[] paramTypes,
- Object[] params,
- boolean staticOnly) {
+ static Method findMethod(Class<?> klass, String method, Class<?>[] paramTypes, Object[] params, boolean staticOnly) {
Method m = findMethod(klass, method, paramTypes, params);
if (staticOnly && !Modifier.isStatic(m.getModifiers())) {
- throw new MethodNotFoundException("Method " + method + "for class "
- + klass + " not found or accessible");
+ throw new MethodNotFoundException("Method " + method + "for class " + klass + " not found or accessible");
}
return m;
}
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
- static Object invokeMethod(ELContext context,
- Method m, Object base, Object[] params) {
+ static Object invokeMethod(ELContext context, Method m, Object base, Object[] params) {
- Object[] parameters = buildParameters(
- context, m.getParameterTypes(), m.isVarArgs(), params);
+ Object[] parameters = buildParameters(context, m.getParameterTypes(), m.isVarArgs(), params);
try {
return m.invoke(base, parameters);
} catch (IllegalAccessException iae) {
@@ -269,17 +245,14 @@
throw new ELException(ite.getCause());
}
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
- static Method findMethod(Class<?> clazz, String methodName,
- Class<?>[] paramTypes, Object[] paramValues) {
+ static Method findMethod(Class<?> clazz, String methodName, Class<?>[] paramTypes, Object[] paramValues) {
if (clazz == null || methodName == null) {
- throw new MethodNotFoundException("Method not found: " +
- clazz + "." + methodName + "(" + paramString(paramTypes) + ")");
+ throw new MethodNotFoundException("Method not found: " + clazz + "." + methodName + "(" + paramString(paramTypes) + ")");
}
if (paramTypes == null) {
@@ -290,8 +263,7 @@
List<Wrapper> wrappers = Wrapper.wrap(methods, methodName);
- Wrapper result = findWrapper(
- clazz, wrappers, methodName, paramTypes, paramValues);
+ Wrapper result = findWrapper(clazz, wrappers, methodName, paramTypes, paramValues);
if (result == null) {
return null;
@@ -300,11 +272,9 @@
}
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
- private static Wrapper findWrapper(Class<?> clazz, List<Wrapper> wrappers,
- String name, Class<?>[] paramTypes, Object[] paramValues) {
+ private static Wrapper findWrapper(Class<?> clazz, List<Wrapper> wrappers, String name, Class<?>[] paramTypes, Object[] paramValues) {
List<Wrapper> assignableCandidates = new ArrayList<Wrapper>();
List<Wrapper> coercibleCandidates = new ArrayList<Wrapper>();
@@ -327,8 +297,7 @@
}
// Check the number of parameters
- if (!(paramCount == mParamCount ||
- (w.isVarArgs() && paramCount >= mParamCount - 1))) {
+ if (!(paramCount == mParamCount || (w.isVarArgs() && paramCount >= mParamCount - 1))) {
// Method has wrong number of parameters
continue;
}
@@ -347,11 +316,11 @@
continue;
}
}
-
+
// unwrap the array's component type
Class<?> varType = mParamTypes[i].getComponentType();
for (int j = i; j < paramCount; j++) {
- if (!isAssignableFrom(paramTypes[j], varType)
+ if (!isAssignableFrom(paramTypes[j], varType)
&& !(paramValues != null && j < paramValues.length && isCoercibleFrom(paramValues[j], varType))) {
noMatch = true;
break;
@@ -377,7 +346,7 @@
if (noMatch) {
continue;
}
-
+
if (varArgs) {
varArgsCandidates.add(w);
} else if (coercible) {
@@ -389,11 +358,10 @@
// return it
return w;
}
-
+
}
-
- String errorMsg = "Unable to find unambiguous method: " +
- clazz + "." + name + "(" + paramString(paramTypes) + ")";
+
+ String errorMsg = "Unable to find unambiguous method: " + clazz + "." + name + "(" + paramString(paramTypes) + ")";
if (!assignableCandidates.isEmpty()) {
return findMostSpecificWrapper(assignableCandidates, paramTypes, false, errorMsg);
} else if (!coercibleCandidates.isEmpty()) {
@@ -401,24 +369,21 @@
} else if (!varArgsCandidates.isEmpty()) {
return findMostSpecificWrapper(varArgsCandidates, paramTypes, true, errorMsg);
} else {
- throw new MethodNotFoundException("Method not found: " +
- clazz + "." + name + "(" + paramString(paramTypes) + ")");
+ throw new MethodNotFoundException("Method not found: " + clazz + "." + name + "(" + paramString(paramTypes) + ")");
}
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
- private static Wrapper findMostSpecificWrapper(List<Wrapper> candidates,
- Class<?>[] matchingTypes, boolean elSpecific, String errorMsg) {
+ private static Wrapper findMostSpecificWrapper(List<Wrapper> candidates, Class<?>[] matchingTypes, boolean elSpecific, String errorMsg) {
List<Wrapper> ambiguouses = new ArrayList<Wrapper>();
for (Wrapper candidate : candidates) {
boolean lessSpecific = false;
-
+
Iterator<Wrapper> it = ambiguouses.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
int result = isMoreSpecific(candidate, it.next(), matchingTypes, elSpecific);
if (result == 1) {
it.remove();
@@ -426,41 +391,39 @@
lessSpecific = true;
}
}
-
+
if (!lessSpecific) {
ambiguouses.add(candidate);
}
}
-
+
if (ambiguouses.size() > 1) {
throw new MethodNotFoundException(errorMsg);
}
-
+
return ambiguouses.get(0);
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
- private static int isMoreSpecific(Wrapper wrapper1, Wrapper wrapper2,
- Class<?>[] matchingTypes, boolean elSpecific) {
+ private static int isMoreSpecific(Wrapper wrapper1, Wrapper wrapper2, Class<?>[] matchingTypes, boolean elSpecific) {
Class<?>[] paramTypes1 = wrapper1.getParameterTypes();
Class<?>[] paramTypes2 = wrapper2.getParameterTypes();
-
+
if (wrapper1.isVarArgs()) {
- //JLS8 15.12.2.5 Choosing the Most Specific Method
- int length = Math.max(Math.max(paramTypes1.length, paramTypes2.length), matchingTypes.length);
+ // JLS8 15.12.2.5 Choosing the Most Specific Method
+ int length = Math.max(Math.max(paramTypes1.length, paramTypes2.length), matchingTypes.length);
paramTypes1 = getComparingParamTypesForVarArgsMethod(paramTypes1, length);
paramTypes2 = getComparingParamTypesForVarArgsMethod(paramTypes2, length);
-
+
if (length > matchingTypes.length) {
Class<?>[] matchingTypes2 = new Class<?>[length];
System.arraycopy(matchingTypes, 0, matchingTypes2, 0, matchingTypes.length);
matchingTypes = matchingTypes2;
}
}
-
+
int result = 0;
for (int i = 0; i < paramTypes1.length; i++) {
if (paramTypes1[i] != paramTypes2[i]) {
@@ -480,7 +443,7 @@
}
}
}
-
+
if (result == 0) {
// The nature of bridge methods is such that it actually
// doesn't matter which one we pick as long as we pick
@@ -488,13 +451,12 @@
// one) anyway.
result = Boolean.compare(wrapper1.isBridge(), wrapper2.isBridge());
}
-
+
return result;
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
private static int isMoreSpecific(Class<?> type1, Class<?> type2, Class<?> matchingType, boolean elSpecific) {
type1 = getBoxingTypeIfPrimitive(type1);
@@ -505,11 +467,10 @@
return -1;
} else {
if (elSpecific) {
- /*
+ /*
* Number will be treated as more specific
*
- * ASTInteger only return Long or BigInteger, no Byte / Short / Integer.
- * ASTFloatingPoint also.
+ * ASTInteger only return Long or BigInteger, no Byte / Short / Integer. ASTFloatingPoint also.
*
*/
if (matchingType != null && Number.class.isAssignableFrom(matchingType)) {
@@ -523,17 +484,16 @@
return 0;
}
}
-
+
return 0;
} else {
return 0;
}
}
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
private static Class<?> getBoxingTypeIfPrimitive(Class<?> clazz) {
if (clazz.isPrimitive()) {
@@ -557,12 +517,11 @@
} else {
return clazz;
}
-
+
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
private static Class<?>[] getComparingParamTypesForVarArgsMethod(Class<?>[] paramTypes, int length) {
Class<?>[] result = new Class<?>[length];
@@ -571,13 +530,12 @@
for (int i = paramTypes.length - 1; i < length; i++) {
result[i] = type;
}
-
+
return result;
}
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
private static final String paramString(Class<?>[] types) {
if (types != null) {
@@ -598,8 +556,7 @@
}
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
static boolean isAssignableFrom(Class<?> src, Class<?> target) {
// src will always be an object
@@ -608,20 +565,18 @@
if (src == null) {
return true;
}
-
+
target = getBoxingTypeIfPrimitive(target);
return target.isAssignableFrom(src);
}
-
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
private static boolean isCoercibleFrom(Object src, Class<?> target) {
// TODO: This isn't pretty but it works. Significant refactoring would
- // be required to avoid the exception.
+ // be required to avoid the exception.
try {
getExpressionFactory().coerceToType(src, target);
} catch (Exception e) {
@@ -631,8 +586,7 @@
}
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
private static Class<?>[] getTypesFromValues(Object[] values) {
if (values == null) {
@@ -650,16 +604,12 @@
return result;
}
-
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*
- * Get a public method form a public class or interface of a given method.
- * Note that if a PropertyDescriptor is obtained for a non-public class that
- * implements a public interface, the read/write methods will be for the
- * class, and therefore inaccessible. To correct this, a version of the
- * same method must be found in a superclass or interface.
+ * Get a public method form a public class or interface of a given method. Note that if a PropertyDescriptor is obtained
+ * for a non-public class that implements a public interface, the read/write methods will be for the class, and
+ * therefore inaccessible. To correct this, a version of the same method must be found in a superclass or interface.
*
*/
static Method getMethod(Class<?> type, Method m) {
@@ -693,10 +643,9 @@
}
return null;
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
static Constructor<?> getConstructor(Class<?> type, Constructor<?> c) {
if (c == null || Modifier.isPublic(type.getModifiers())) {
@@ -717,13 +666,11 @@
}
return null;
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
- static Object[] buildParameters(ELContext context, Class<?>[] parameterTypes,
- boolean isVarArgs,Object[] params) {
+ static Object[] buildParameters(ELContext context, Class<?>[] parameterTypes, boolean isVarArgs, Object[] params) {
Object[] parameters = null;
if (parameterTypes.length > 0) {
parameters = new Object[parameterTypes.length];
@@ -732,41 +679,33 @@
int varArgIndex = parameterTypes.length - 1;
// First argCount-1 parameters are standard
for (int i = 0; (i < varArgIndex && i < paramCount); i++) {
- parameters[i] = context.convertToType(params[i],
- parameterTypes[i]);
+ parameters[i] = context.convertToType(params[i], parameterTypes[i]);
}
// Last parameter is the varargs
- if (parameterTypes.length == paramCount
- && parameterTypes[varArgIndex] == params[varArgIndex].getClass()) {
+ if (parameterTypes.length == paramCount && parameterTypes[varArgIndex] == params[varArgIndex].getClass()) {
parameters[varArgIndex] = params[varArgIndex];
} else {
- Class<?> varArgClass =
- parameterTypes[varArgIndex].getComponentType();
- final Object varargs = Array.newInstance(
- varArgClass,
- (paramCount - varArgIndex));
+ Class<?> varArgClass = parameterTypes[varArgIndex].getComponentType();
+ final Object varargs = Array.newInstance(varArgClass, (paramCount - varArgIndex));
for (int i = (varArgIndex); i < paramCount; i++) {
- Array.set(varargs, i - varArgIndex,
- context.convertToType(params[i], varArgClass));
+ Array.set(varargs, i - varArgIndex, context.convertToType(params[i], varArgClass));
}
parameters[varArgIndex] = varargs;
}
} else {
for (int i = 0; i < parameterTypes.length && i < paramCount; i++) {
- parameters[i] = context.convertToType(params[i],
- parameterTypes[i]);
+ parameters[i] = context.convertToType(params[i], parameterTypes[i]);
}
}
}
return parameters;
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
private abstract static class Wrapper {
-
+
public static List<Wrapper> wrap(Method[] methods, String name) {
List<Wrapper> result = new ArrayList<>();
for (Method method : methods) {
@@ -776,7 +715,7 @@
}
return result;
}
-
+
public static List<Wrapper> wrap(Constructor<?>[] constructors) {
List<Wrapper> result = new ArrayList<>();
for (Constructor<?> constructor : constructors) {
@@ -784,75 +723,76 @@
}
return result;
}
-
+
public abstract Object unWrap();
+
public abstract Class<?>[] getParameterTypes();
+
public abstract boolean isVarArgs();
+
public abstract boolean isBridge();
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
private static class MethodWrapper extends Wrapper {
private final Method m;
-
+
public MethodWrapper(Method m) {
this.m = m;
}
-
+
@Override
public Object unWrap() {
return m;
}
-
+
@Override
public Class<?>[] getParameterTypes() {
return m.getParameterTypes();
}
-
+
@Override
public boolean isVarArgs() {
return m.isVarArgs();
}
-
+
@Override
public boolean isBridge() {
return m.isBridge();
}
}
-
+
/*
- * This method duplicates code in com.sun.el.util.ReflectionUtil. When
- * making changes keep the code in sync.
+ * This method duplicates code in com.sun.el.util.ReflectionUtil. When making changes keep the code in sync.
*/
private static class ConstructorWrapper extends Wrapper {
private final Constructor<?> c;
-
+
public ConstructorWrapper(Constructor<?> c) {
this.c = c;
}
-
+
@Override
public Object unWrap() {
return c;
}
-
+
@Override
public Class<?>[] getParameterTypes() {
return c.getParameterTypes();
}
-
+
@Override
public boolean isVarArgs() {
return c.isVarArgs();
}
-
+
@Override
public boolean isBridge() {
return false;
}
}
-
+
}
diff --git a/api/src/main/java/javax/el/EvaluationListener.java b/api/src/main/java/javax/el/EvaluationListener.java
index a26c9d9..1a4fde9 100644
--- a/api/src/main/java/javax/el/EvaluationListener.java
+++ b/api/src/main/java/javax/el/EvaluationListener.java
@@ -17,8 +17,7 @@
package javax.el;
/**
- * The listener interface for receiving notification when an
- * EL expression is evaluated.
+ * The listener interface for receiving notification when an EL expression is evaluated.
*
* @since EL 3.0
*/
@@ -26,6 +25,7 @@
/**
* Receives notification before an EL expression is evaluated
+ *
* @param context The ELContext
* @param expression The EL expression string to be evaluated
*/
@@ -34,6 +34,7 @@
/**
* Receives notification after an EL expression is evaluated
+ *
* @param context The ELContext
* @param expression The EL expression string to be evaluated
*/
@@ -42,6 +43,7 @@
/**
* Receives notification when the (base, property) pair is resolved
+ *
* @param context The ELContext
* @param base The base object
* @param property The property object
diff --git a/api/src/main/java/javax/el/Expression.java b/api/src/main/java/javax/el/Expression.java
index dd6ba50..1b5c433 100644
--- a/api/src/main/java/javax/el/Expression.java
+++ b/api/src/main/java/javax/el/Expression.java
@@ -20,81 +20,80 @@
import java.io.Serializable;
/**
- * Base class for the expression subclasses {@link ValueExpression} and
- * {@link MethodExpression}, implementing characteristics common to both.
+ * Base class for the expression subclasses {@link ValueExpression} and {@link MethodExpression}, implementing
+ * characteristics common to both.
*
- * <p>All expressions must implement the <code>equals()</code> and
- * <code>hashCode()</code> methods so that two expressions can be compared
- * for equality. They are redefined abstract in this class to force their
- * implementation in subclasses.</p>
+ * <p>
+ * All expressions must implement the <code>equals()</code> and <code>hashCode()</code> methods so that two expressions
+ * can be compared for equality. They are redefined abstract in this class to force their implementation in subclasses.
+ * </p>
*
- * <p>All expressions must also be <code>Serializable</code> so that they
- * can be saved and restored.</p>
+ * <p>
+ * All expressions must also be <code>Serializable</code> so that they can be saved and restored.
+ * </p>
*
- * <p><code>Expression</code>s are also designed to be immutable so
- * that only one instance needs to be created for any given expression
- * String / {@link FunctionMapper}. This allows a container to pre-create
- * expressions and not have to re-parse them each time they are evaluated.</p>
+ * <p>
+ * <code>Expression</code>s are also designed to be immutable so that only one instance needs to be created for any
+ * given expression String / {@link FunctionMapper}. This allows a container to pre-create expressions and not have to
+ * re-parse them each time they are evaluated.
+ * </p>
*
* @since JSP 2.1
*/
-public abstract class Expression
- implements Serializable {
+public abstract class Expression implements Serializable {
// Debugging
-
+
/**
- * Returns the original String used to create this <code>Expression</code>,
- * unmodified.
+ * Returns the original String used to create this <code>Expression</code>, unmodified.
*
- * <p>This is used for debugging purposes but also for the purposes
- * of comparison (e.g. to ensure the expression in a configuration
- * file has not changed).</p>
+ * <p>
+ * This is used for debugging purposes but also for the purposes of comparison (e.g. to ensure the expression in a
+ * configuration file has not changed).
+ * </p>
*
- * <p>This method does not provide sufficient information to
- * re-create an expression. Two different expressions can have exactly
- * the same expression string but different function mappings.
- * Serialization should be used to save and restore the state of an
- * <code>Expression</code>.</p>
+ * <p>
+ * This method does not provide sufficient information to re-create an expression. Two different expressions can have
+ * exactly the same expression string but different function mappings. Serialization should be used to save and restore
+ * the state of an <code>Expression</code>.
+ * </p>
*
* @return The original expression String.
*/
public abstract String getExpressionString();
-
+
// Comparison
-
+
/**
- * Determines whether the specified object is equal to this
- * <code>Expression</code>.
+ * Determines whether the specified object is equal to this <code>Expression</code>.
*
- * <p>The result is <code>true</code> if and only if the argument is
- * not <code>null</code>, is an <code>Expression</code> object that
- * is the of the same type (<code>ValueExpression</code> or
- * <code>MethodExpression</code>), and has an identical parsed
- * representation.</p>
+ * <p>
+ * The result is <code>true</code> if and only if the argument is not <code>null</code>, is an <code>Expression</code>
+ * object that is the of the same type (<code>ValueExpression</code> or <code>MethodExpression</code>), and has an
+ * identical parsed representation.
+ * </p>
*
- * <p>Note that two expressions can be equal if their expression
- * Strings are different. For example, <code>${fn1:foo()}</code>
- * and <code>${fn2:foo()}</code> are equal if their corresponding
- * <code>FunctionMapper</code>s mapped <code>fn1:foo</code> and
- * <code>fn2:foo</code> to the same method.</p>
+ * <p>
+ * Note that two expressions can be equal if their expression Strings are different. For example,
+ * <code>${fn1:foo()}</code> and <code>${fn2:foo()}</code> are equal if their corresponding <code>FunctionMapper</code>s
+ * mapped <code>fn1:foo</code> and <code>fn2:foo</code> to the same method.
+ * </p>
*
* @param obj the <code>Object</code> to test for equality.
- * @return <code>true</code> if <code>obj</code> equals this
- * <code>Expression</code>; <code>false</code> otherwise.
+ * @return <code>true</code> if <code>obj</code> equals this <code>Expression</code>; <code>false</code> otherwise.
* @see java.util.Hashtable
* @see java.lang.Object#equals(java.lang.Object)
*/
public abstract boolean equals(Object obj);
-
+
/**
* Returns the hash code for this <code>Expression</code>.
*
- * <p>See the note in the {@link #equals} method on how two expressions
- * can be equal if their expression Strings are different. Recall that
- * if two objects are equal according to the <code>equals(Object)</code>
- * method, then calling the <code>hashCode</code> method on each of the
- * two objects must produce the same integer result. Implementations must
- * take special note and implement <code>hashCode</code> correctly.</p>
+ * <p>
+ * See the note in the {@link #equals} method on how two expressions can be equal if their expression Strings are
+ * different. Recall that if two objects are equal according to the <code>equals(Object)</code> method, then calling the
+ * <code>hashCode</code> method on each of the two objects must produce the same integer result. Implementations must
+ * take special note and implement <code>hashCode</code> correctly.
+ * </p>
*
* @return The hash code for this <code>Expression</code>.
* @see #equals
@@ -102,18 +101,16 @@
* @see java.lang.Object#hashCode()
*/
public abstract int hashCode();
-
+
/**
* Returns whether this expression was created from only literal text.
*
- * <p>This method must return <code>true</code> if and only if the
- * expression string this expression was created from contained no
- * unescaped EL delimeters (<code>${...}</code> or
- * <code>#{...}</code>).</p>
+ * <p>
+ * This method must return <code>true</code> if and only if the expression string this expression was created from
+ * contained no unescaped EL delimeters (<code>${...}</code> or <code>#{...}</code>).
+ * </p>
*
- * @return <code>true</code> if this expression was created from only
- * literal text; <code>false</code> otherwise.
+ * @return <code>true</code> if this expression was created from only literal text; <code>false</code> otherwise.
*/
public abstract boolean isLiteralText();
}
-
diff --git a/api/src/main/java/javax/el/ExpressionFactory.java b/api/src/main/java/javax/el/ExpressionFactory.java
index 744eb93..4822f80 100644
--- a/api/src/main/java/javax/el/ExpressionFactory.java
+++ b/api/src/main/java/javax/el/ExpressionFactory.java
@@ -25,76 +25,62 @@
* Provides an implementation for creating and evaluating EL expressions.
*
* <p>
- * Classes that implement the EL expression language expose their
- * functionality via this abstract class. An implementation supports the
- * following functionalities.
+ * Classes that implement the EL expression language expose their functionality via this abstract class. An
+ * implementation supports the following functionalities.
*
* <ul>
- * <li>
- * Parses a <code>String</code> into a {@link ValueExpression} or
- * {@link MethodExpression} instance for later evaluation.
- * </li>
- * <li>Implements an <code>ELResolver</code> for query operators</li>
- * <li>Provides a default type coercion</li>
+ * <li>Parses a <code>String</code> into a {@link ValueExpression} or {@link MethodExpression} instance for later
+ * evaluation.</li>
+ * <li>Implements an <code>ELResolver</code> for query operators</li>
+ * <li>Provides a default type coercion</li>
* </ul>
*
- * <p>The {@link #newInstance} method can be used to obtain an
- * instance of the implementation.
- * Technologies such as
- * JavaServer Pages and JavaServer Faces provide access to an
- * implementation via factory methods.
+ * <p>
+ * The {@link #newInstance} method can be used to obtain an instance of the implementation. Technologies such as
+ * JavaServer Pages and JavaServer Faces provide access to an implementation via factory methods.
*
- * <p>The {@link #createValueExpression} method is used to parse expressions
- * that evaluate to values (both l-values and r-values are supported).
- * The {@link #createMethodExpression} method is used to parse expressions
- * that evaluate to a reference to a method on an object.
+ * <p>
+ * The {@link #createValueExpression} method is used to parse expressions that evaluate to values (both l-values and
+ * r-values are supported). The {@link #createMethodExpression} method is used to parse expressions that evaluate to a
+ * reference to a method on an object.
*
- * <p>Resolution of model objects is performed at evaluation time, via the
- * {@link ELResolver} associated with the {@link ELContext} passed to
- * the <code>ValueExpression</code> or <code>MethodExpression</code>.
+ * <p>
+ * Resolution of model objects is performed at evaluation time, via the {@link ELResolver} associated with the
+ * {@link ELContext} passed to the <code>ValueExpression</code> or <code>MethodExpression</code>.
*
- * <p>The ELContext object also provides access to the {@link FunctionMapper}
- * and {@link VariableMapper} to be used when parsing the expression.
- * EL function and variable mapping is performed at parse-time, and
- * the results are
- * bound to the expression. Therefore, the {@link ELContext},
- * {@link FunctionMapper},
- * and {@link VariableMapper}
- * are not stored for future use and do not have to be
- * <code>Serializable</code>.
+ * <p>
+ * The ELContext object also provides access to the {@link FunctionMapper} and {@link VariableMapper} to be used when
+ * parsing the expression. EL function and variable mapping is performed at parse-time, and the results are bound to the
+ * expression. Therefore, the {@link ELContext}, {@link FunctionMapper}, and {@link VariableMapper} are not stored for
+ * future use and do not have to be <code>Serializable</code>.
*
- * <p>The <code>createValueExpression</code> and
- * <code>createMethodExpression</code> methods must be thread-safe. That is,
- * multiple threads may call these methods on the same
- * <code>ExpressionFactory</code> object simultaneously. Implementations
- * should synchronize access if they depend on transient state.
- * Implementations should not, however, assume that only one object of
- * each <code>ExpressionFactory</code> type will be instantiated; global
- * caching should therefore be static.
+ * <p>
+ * The <code>createValueExpression</code> and <code>createMethodExpression</code> methods must be thread-safe. That is,
+ * multiple threads may call these methods on the same <code>ExpressionFactory</code> object simultaneously.
+ * Implementations should synchronize access if they depend on transient state. Implementations should not, however,
+ * assume that only one object of each <code>ExpressionFactory</code> type will be instantiated; global caching should
+ * therefore be static.
*
- * <p>The <code>ExpressionFactory</code> must be able to handle the following
- * types of input for the <code>expression</code> parameter:
+ * <p>
+ * The <code>ExpressionFactory</code> must be able to handle the following types of input for the
+ * <code>expression</code> parameter:
* <ul>
- * <li>Single expressions using the <code>${}</code> delimiter
- * (e.g. <code>"${employee.lastName}"</code>).</li>
- * <li>Single expressions using the <code>#{}</code> delimiter
- * (e.g. <code>"#{employee.lastName}"</code>).</li>
- * <li>Literal text containing no <code>${}</code> or <code>#{}</code>
- * delimiters (e.g. <code>"John Doe"</code>).</li>
- * <li>Multiple expressions using the same delimiter (e.g.
- * <code>"${employee.firstName}${employee.lastName}"</code> or
- * <code>"#{employee.firstName}#{employee.lastName}"</code>).</li>
- * <li>Mixed literal text and expressions using the same delimiter (e.g.
- * <code>"Name: ${employee.firstName} ${employee.lastName}"</code>).</li>
+ * <li>Single expressions using the <code>${}</code> delimiter (e.g. <code>"${employee.lastName}"</code>).</li>
+ * <li>Single expressions using the <code>#{}</code> delimiter (e.g. <code>"#{employee.lastName}"</code>).</li>
+ * <li>Literal text containing no <code>${}</code> or <code>#{}</code> delimiters (e.g. <code>"John Doe"</code>).</li>
+ * <li>Multiple expressions using the same delimiter (e.g. <code>"${employee.firstName}${employee.lastName}"</code> or
+ * <code>"#{employee.firstName}#{employee.lastName}"</code>).</li>
+ * <li>Mixed literal text and expressions using the same delimiter (e.g.
+ * <code>"Name: ${employee.firstName} ${employee.lastName}"</code>).</li>
* </ul>
*
- * <p>The following types of input are illegal and must cause an
- * {@link ELException} to be thrown:
+ * <p>
+ * The following types of input are illegal and must cause an {@link ELException} to be thrown:
* <ul>
- * <li>Multiple expressions using different delimiters (e.g.
- * <code>"${employee.firstName}#{employee.lastName}"</code>).</li>
- * <li>Mixed literal text and expressions using different delimiters(e.g.
- * <code>"Name: ${employee.firstName} #{employee.lastName}"</code>).</li>
+ * <li>Multiple expressions using different delimiters (e.g.
+ * <code>"${employee.firstName}#{employee.lastName}"</code>).</li>
+ * <li>Mixed literal text and expressions using different delimiters(e.g.
+ * <code>"Name: ${employee.firstName} #{employee.lastName}"</code>).</li>
* </ul>
*
* @since JSP 2.1
@@ -102,25 +88,18 @@
public abstract class ExpressionFactory {
/**
- * Creates a new instance of a <code>ExpressionFactory</code>.
- * This method uses the following ordered lookup procedure to determine
- * the <code>ExpressionFactory</code> implementation class to load:
+ * Creates a new instance of a <code>ExpressionFactory</code>. This method uses the following ordered lookup procedure
+ * to determine the <code>ExpressionFactory</code> implementation class to load:
*
* <ul>
- * <li>Use the Services API (as detailed in the JAR specification).
- * If a resource with the name of
- * <code>META-INF/services/javax.el.ExpressionFactory</code> exists,
- * then its first line, if present, is used as the UTF-8 encoded name of
- * the implementation class. </li>
- * <li>Use the properties file "lib/el.properties" in the JRE directory.
- * If this file exists and it is readable by the
- * <code> java.util.Properties.load(InputStream)</code> 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.</li>
- * <li>Use the <code>javax.el.ExpressionFactory</code> system property.
- * If a system property with this name is defined, then its value is
- * used as the name of the implementation class.</li>
+ * <li>Use the Services API (as detailed in the JAR specification). If a resource with the name of
+ * <code>META-INF/services/javax.el.ExpressionFactory</code> exists, then its first line, if present, is used as the
+ * UTF-8 encoded name of the implementation class.</li>
+ * <li>Use the properties file "lib/el.properties" in the JRE directory. If this file exists and it is readable by the
+ * <code> java.util.Properties.load(InputStream)</code> 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.</li>
+ * <li>Use the <code>javax.el.ExpressionFactory</code> system property. If a system property with this name is defined,
+ * then its value is used as the name of the implementation class.</li>
* <li>Use a platform default implementation.</li>
* </ul>
*
@@ -131,18 +110,14 @@
}
/**
- * Create a new instance of a <code>ExpressionFactory</code>, with
- * optional properties.
+ * Create a new instance of a <code>ExpressionFactory</code>, with optional properties.
*
* <p>
- * This method uses the same lookup procedure as the one used in
- * <code>newInstance()</code>.
+ * This method uses the same lookup procedure as the one used in <code>newInstance()</code>.
*
* <p>
- * If the argument <code>properties</code> is not null, and if the
- * implementation contains a constructor with a single parameter of
- * type <code>java.util.Properties</code>, then the constructor is used
- * to create the instance.
+ * If the argument <code>properties</code> is not null, and if the implementation contains a constructor with a single
+ * parameter of type <code>java.util.Properties</code>, then the constructor is used to create the instance.
*
* <p>
* Properties are optional and can be ignored by an implementation.
@@ -156,166 +131,116 @@
* <li>javax.el.cacheSize</li>
* </ul>
*
- * @param properties Properties passed to the implementation.
- * If null, then no properties.
+ * @param properties Properties passed to the implementation. If null, then no properties.
*
* @return a new <code>ExpressionFactory</code> instance
*/
public static ExpressionFactory newInstance(Properties properties) {
- return (ExpressionFactory) FactoryFinder.find(
- "javax.el.ExpressionFactory",
- "com.sun.el.ExpressionFactoryImpl",
- properties);
+ return (ExpressionFactory) FactoryFinder.find("javax.el.ExpressionFactory", "com.sun.el.ExpressionFactoryImpl", properties);
}
/**
- * Parses an expression into a {@link ValueExpression} for later
- * evaluation. Use this method for expressions that refer to values.
+ * Parses an expression into a {@link ValueExpression} for later evaluation. Use this method for expressions that refer
+ * to values.
*
- * <p>This method should perform syntactic validation of the expression.
- * If in doing so it detects errors, it should raise an
- * <code>ELException</code>.</p>
+ * <p>
+ * This method should perform syntactic validation of the expression. If in doing so it detects errors, it should raise
+ * an <code>ELException</code>.
+ * </p>
*
- * @param context The EL context used to parse the expression.
- * The <code>FunctionMapper</code> and <code>VariableMapper</code>
- * stored in the ELContext
- * are used to resolve functions and variables found in
- * the expression. They can be <code>null</code>, 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 <code>FunctionMapper</code>
- * and <code>VariableMapper</code> instances
- * change between calling
- * <code>ExpressionFactory.createValueExpression()</code> and any
- * method on <code>ValueExpression</code>.
- * 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.
+ * @param context The EL context used to parse the expression. The <code>FunctionMapper</code> and
+ * <code>VariableMapper</code> stored in the ELContext are used to resolve functions and variables found in the
+ * expression. They can be <code>null</code>, 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 <code>FunctionMapper</code> and <code>VariableMapper</code> instances change
+ * between calling <code>ExpressionFactory.createValueExpression()</code> and any method on
+ * <code>ValueExpression</code>. 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.
* @param expression The expression to parse
- * @param expectedType The type the result of the expression
- * will be coerced to after evaluation.
+ * @param expectedType The type the result of the expression will be coerced to after evaluation.
* @return The parsed expression
* @throws NullPointerException Thrown if expectedType is null.
- * @throws ELException Thrown if there are syntactical errors in the
- * provided expression.
+ * @throws ELException Thrown if there are syntactical errors in the provided expression.
*/
- public abstract ValueExpression createValueExpression(
- ELContext context,
- String expression,
- Class<?> expectedType);
+ public abstract ValueExpression createValueExpression(ELContext context, String expression, Class<?> expectedType);
/**
* Creates a ValueExpression that wraps an object instance.
*
* <p>
- * 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 <code>getValue()</code> method, optionally coerced.
+ * 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 <code>getValue()</code> method, optionally coerced.
* </p>
*
* @param instance The object instance to be wrapped.
- * @param expectedType The type the result of the expression
- * will be coerced to after evaluation. There will be no
- * coercion if it is Object.class,
+ * @param 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 NullPointerException Thrown if expectedType is null.
* @return a ValueExpression that wraps an object instance
*/
- public abstract ValueExpression createValueExpression(
- Object instance,
- Class<?> expectedType);
+ public abstract ValueExpression createValueExpression(Object instance, Class<?> expectedType);
/**
- * Parses an expression into a {@link MethodExpression} for later
- * evaluation. Use this method for expressions that refer to methods.
+ * Parses an expression into a {@link MethodExpression} for later evaluation. Use this method for expressions that refer
+ * to methods.
*
* <p>
* If the expression is a String literal, a <code>MethodExpression
- * </code> 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").
+ * </code> 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").
*
- * <p>This method should perform syntactic validation of the expression.
- * If in doing so it detects errors, it should raise an
- * <code>ELException</code>.
+ * <p>
+ * This method should perform syntactic validation of the expression. If in doing so it detects errors, it should raise
+ * an <code>ELException</code>.
*
- * @param context The EL context used to parse the expression.
- * The <code>FunctionMapper</code> and <code>VariableMapper</code>
- * stored in the ELContext
- * are used to resolve functions and variables found in
- * the expression. They can be <code>null</code>, 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 <code>FunctionMapper</code>
- * and <code>VariableMapper</code> instances
- * change between calling
- * <code>ExpressionFactory.createMethodExpression()</code> and any
- * method on <code>MethodExpression</code>.
- * 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.
+ * @param context The EL context used to parse the expression. The <code>FunctionMapper</code> and
+ * <code>VariableMapper</code> stored in the ELContext are used to resolve functions and variables found in the
+ * expression. They can be <code>null</code>, 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 <code>FunctionMapper</code> and <code>VariableMapper</code> instances change
+ * between calling <code>ExpressionFactory.createMethodExpression()</code> and any method on
+ * <code>MethodExpression</code>. 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.
* @param expression The expression to parse
- * @param expectedReturnType The expected return type for the method
- * to be found. After evaluating the expression, the
- * <code>MethodExpression</code> must check that the return type of
- * the actual method matches this type. Passing in a value of
- * <code>null</code> indicates the caller does not care what the
- * return type is, and the check is disabled.
- * @param 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 <code>null</code>,
- * unless the method is specified with arguments in the EL
- * expression, in which case these arguments are used for method
- * selection, and this parameter is ignored.
+ * @param expectedReturnType The expected return type for the method to be found. After evaluating the expression, the
+ * <code>MethodExpression</code> must check that the return type of the actual method matches this type. Passing in a
+ * value of <code>null</code> indicates the caller does not care what the return type is, and the check is disabled.
+ * @param 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 <code>null</code>, unless the method is specified with
+ * arguments in the EL expression, in which case these arguments are used for method selection, and this parameter is
+ * ignored.
* @return The parsed expression
- * @throws ELException Thrown if there are syntactical errors in the
- * provided expression.
+ * @throws ELException Thrown if there are syntactical errors in the provided expression.
* @throws NullPointerException if paramTypes is <code>null</code>.
*/
- public abstract MethodExpression createMethodExpression(
- ELContext context,
- String expression,
- Class<?> expectedReturnType,
- Class<?>[] expectedParamTypes);
+ public abstract MethodExpression createMethodExpression(ELContext context, String expression, Class<?> expectedReturnType, Class<?>[] expectedParamTypes);
/**
- * Coerces an object to a specific type according to the
- * EL type conversion rules. The custom type conversions in the
+ * Coerces an object to a specific type according to the EL type conversion rules. The custom type conversions in the
* <code>ELResolver</code>s are not considered.
*
- * <p>An <code>ELException</code> is thrown if an error results from
- * applying the conversion rules.
+ * <p>
+ * An <code>ELException</code> is thrown if an error results from applying the conversion rules.
*
* @param obj The object to coerce.
* @param targetType The target type for the coercion.
* @return an object coerced to <code>targetType</code>
- * @throws ELException thrown if an error results from applying the
- * conversion rules.
+ * @throws ELException thrown if an error results from applying the conversion rules.
*/
- public abstract Object coerceToType(
- Object obj,
- Class<?> targetType);
+ public abstract Object coerceToType(Object obj, Class<?> targetType);
/**
* Retrieves an ELResolver that implements the operations in collections.
*
* <p>
- * This ELResolver resolves the method invocation on the pair
- * (<code>base</code>, <code>property</code>) when <code>base</code> is
- * a <code>Collection</code> or a <code>Map</code>, and
- * <code>property</code> is the name of the operation.
- * <p>See EL.2 for detailed descriptions of these operators, their
- * arguments, and return values.
+ * This ELResolver resolves the method invocation on the pair (<code>base</code>, <code>property</code>) when
+ * <code>base</code> is a <code>Collection</code> or a <code>Map</code>, and <code>property</code> is the name of the
+ * operation.
+ * <p>
+ * See EL.2 for detailed descriptions of these operators, their arguments, and return values.
*
* @return The <code>ELResolver</code> that implements the Query Operators.
*
@@ -326,8 +251,7 @@
}
/**
- * Retrieve a function map containing a pre-configured function
- * mapping.
+ * Retrieve a function map containing a pre-configured function mapping.
*
* @return A initial map for functions, null if there is none.
*
@@ -337,5 +261,3 @@
return null;
}
}
-
-
diff --git a/api/src/main/java/javax/el/FactoryFinder.java b/api/src/main/java/javax/el/FactoryFinder.java
index 6a6e6f2..0941d2a 100644
--- a/api/src/main/java/javax/el/FactoryFinder.java
+++ b/api/src/main/java/javax/el/FactoryFinder.java
@@ -28,16 +28,11 @@
class FactoryFinder {
/**
- * Creates an instance of the specified class using the specified
- * <code>ClassLoader</code> object.
+ * Creates an instance of the specified class using the specified <code>ClassLoader</code> object.
*
- * @exception ELException if the given class could not be found
- * or could not be instantiated
+ * @exception ELException if the given class could not be found or could not be instantiated
*/
- private static Object newInstance(String className,
- ClassLoader classLoader,
- Properties properties)
- {
+ private static Object newInstance(String className, ClassLoader classLoader, Properties properties) {
try {
Class<?> spiClass;
if (classLoader == null) {
@@ -57,38 +52,27 @@
}
return spiClass.newInstance();
} catch (ClassNotFoundException x) {
- throw new ELException(
- "Provider " + className + " not found", x);
+ throw new ELException("Provider " + className + " not found", x);
} catch (Exception x) {
- throw new ELException(
- "Provider " + className + " could not be instantiated: " + x,
- x);
+ throw new ELException("Provider " + className + " could not be instantiated: " + x, x);
}
}
/**
- * Finds the implementation <code>Class</code> object for the given
- * factory name, or if that fails, finds the <code>Class</code> object
- * for the given fallback class name. The arguments supplied must be
- * used in order. If using the first argument is successful, the second
- * one will not be used.
+ * Finds the implementation <code>Class</code> object for the given factory name, or if that fails, finds the
+ * <code>Class</code> object for the given fallback class name. The arguments supplied must be used in order. If using
+ * the first argument is successful, the second one will not be used.
* <P>
* This method is package private so that this code can be shared.
*
- * @return the <code>Class</code> object of the specified message factory;
- * may not be <code>null</code>
+ * @return the <code>Class</code> object of the specified message factory; may not be <code>null</code>
*
- * @param factoryId the name of the factory to find, which is
- * a system property
- * @param fallbackClassName the implementation class name, which is
- * to be used only if nothing else
- * is found; <code>null</code> to indicate that
- * there is no fallback class name
+ * @param factoryId the name of the factory to find, which is a system property
+ * @param fallbackClassName the implementation class name, which is to be used only if nothing else is found;
+ * <code>null</code> to indicate that there is no fallback class name
* @exception ELException if there is an error
*/
- static Object find(String factoryId, String fallbackClassName,
- Properties properties)
- {
+ static Object find(String factoryId, String fallbackClassName, Properties properties) {
ClassLoader classLoader;
try {
classLoader = Thread.currentThread().getContextClassLoader();
@@ -99,61 +83,53 @@
String serviceId = "META-INF/services/" + factoryId;
// try to find services in CLASSPATH
try {
- InputStream is=null;
+ InputStream is = null;
if (classLoader == null) {
- is=ClassLoader.getSystemResourceAsStream(serviceId);
+ is = ClassLoader.getSystemResourceAsStream(serviceId);
} else {
- is=classLoader.getResourceAsStream(serviceId);
+ is = classLoader.getResourceAsStream(serviceId);
}
-
- if( is!=null ) {
- BufferedReader rd =
- new BufferedReader(new InputStreamReader(is, "UTF-8"));
-
+
+ if (is != null) {
+ BufferedReader rd = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+
String factoryClassName = rd.readLine();
rd.close();
- if (factoryClassName != null &&
- ! "".equals(factoryClassName)) {
+ if (factoryClassName != null && !"".equals(factoryClassName)) {
return newInstance(factoryClassName, classLoader, properties);
}
}
- } catch( Exception ex ) {
+ } catch (Exception ex) {
}
-
// try to read from $java.home/lib/el.properties
try {
- String javah=System.getProperty( "java.home" );
- String configFile = javah + File.separator +
- "lib" + File.separator + "el.properties";
- File f=new File( configFile );
- if( f.exists()) {
- Properties props=new Properties();
- props.load( new FileInputStream(f));
+ String javah = System.getProperty("java.home");
+ String configFile = javah + File.separator + "lib" + File.separator + "el.properties";
+ File f = new File(configFile);
+ if (f.exists()) {
+ Properties props = new Properties();
+ props.load(new FileInputStream(f));
String factoryClassName = props.getProperty(factoryId);
return newInstance(factoryClassName, classLoader, properties);
}
- } catch(Exception ex ) {
+ } catch (Exception ex) {
}
-
// Use the system property
try {
- String systemProp =
- System.getProperty( factoryId );
- if( systemProp!=null) {
+ String systemProp = System.getProperty(factoryId);
+ if (systemProp != null) {
return newInstance(systemProp, classLoader, properties);
}
} catch (SecurityException se) {
}
if (fallbackClassName == null) {
- throw new ELException(
- "Provider for " + factoryId + " cannot be found", null);
+ throw new ELException("Provider for " + factoryId + " cannot be found", null);
}
return newInstance(fallbackClassName, classLoader, properties);
}
}
-
diff --git a/api/src/main/java/javax/el/FunctionMapper.java b/api/src/main/java/javax/el/FunctionMapper.java
index c3999c0..8d4156e 100644
--- a/api/src/main/java/javax/el/FunctionMapper.java
+++ b/api/src/main/java/javax/el/FunctionMapper.java
@@ -22,45 +22,40 @@
/**
* The interface to a map between EL function names and methods.
*
- * <p>A <code>FunctionMapper</code> maps <code>${prefix:name()}</code>
- * style functions to a static method that can execute that function.</p>
+ * <p>
+ * A <code>FunctionMapper</code> maps <code>${prefix:name()}</code> style functions to a static method that can execute
+ * that function.
+ * </p>
*
* @since JSP 2.1
*/
public abstract class FunctionMapper {
-
- /**
- * Resolves the specified prefix and local name into a
- * <code>java.lang.Method</code>.
- *
- * <p>Returns <code>null</code> if no function could be found that matches
- * the given prefix and local name.</p>
- *
- * @param prefix the prefix of the function, or "" if no prefix.
- * For example, <code>"fn"</code> in <code>${fn:method()}</code>, or
- * <code>""</code> in <code>${method()}</code>.
- * @param localName the short name of the function. For example,
- * <code>"method"</code> in <code>${fn:method()}</code>.
- * @return the static method to invoke, or <code>null</code> if no
- * match was found.
- */
- public abstract Method resolveFunction(String prefix,
- String localName);
-
- /**
- * Adds a static method that can be used as a function.
- * @param prefix the prefix of the function, or "" if no prefix.
- * For example, <code>"fn"</code> in <code>${fn:method()}</code>, or
- * <code>""</code> in <code>${method()}</code>.
- * @param localName the short name of the function. For example,
- * <code>"method"</code> in <code>${fn:method()}</code>.
- * @param meth The static method that is to be invoked, when the function is
- * referenced. The null value causes the function to be removed from the
- * map.
- *
- * @since EL 3.0
- */
- public void mapFunction(String prefix, String localName, Method meth) {
- }
+ /**
+ * Resolves the specified prefix and local name into a <code>java.lang.Method</code>.
+ *
+ * <p>
+ * Returns <code>null</code> if no function could be found that matches the given prefix and local name.
+ * </p>
+ *
+ * @param prefix the prefix of the function, or "" if no prefix. For example, <code>"fn"</code> in
+ * <code>${fn:method()}</code>, or <code>""</code> in <code>${method()}</code>.
+ * @param localName the short name of the function. For example, <code>"method"</code> in <code>${fn:method()}</code>.
+ * @return the static method to invoke, or <code>null</code> if no match was found.
+ */
+ public abstract Method resolveFunction(String prefix, String localName);
+
+ /**
+ * Adds a static method that can be used as a function.
+ *
+ * @param prefix the prefix of the function, or "" if no prefix. For example, <code>"fn"</code> in
+ * <code>${fn:method()}</code>, or <code>""</code> in <code>${method()}</code>.
+ * @param localName the short name of the function. For example, <code>"method"</code> in <code>${fn:method()}</code>.
+ * @param meth The static method that is to be invoked, when the function is referenced. The null value causes the
+ * function to be removed from the map.
+ *
+ * @since EL 3.0
+ */
+ public void mapFunction(String prefix, String localName, Method meth) {
+ }
}
diff --git a/api/src/main/java/javax/el/ImportHandler.java b/api/src/main/java/javax/el/ImportHandler.java
index 738031f..89244c9 100644
--- a/api/src/main/java/javax/el/ImportHandler.java
+++ b/api/src/main/java/javax/el/ImportHandler.java
@@ -24,11 +24,9 @@
import java.lang.reflect.Modifier;
/**
- * Handles imports of class names and package names. An imported package
- * name implicitly imports all the classes in the package. A class that has
- * been imported can be used without its package name.
- * The name is resolved to its full (package and class) name
- * at evaluation time.
+ * Handles imports of class names and package names. An imported package name implicitly imports all the classes in the
+ * package. A class that has been imported can be used without its package name. The name is resolved to its full
+ * (package and class) name at evaluation time.
*/
public class ImportHandler {
@@ -44,38 +42,38 @@
/**
* Import a static field or method.
- * @param name The static member name, including the full class name,
- * to be imported
+ *
+ * @param name The static member name, including the full class name, to be imported
* @throws ELException if the name does not include a ".".
*/
public void importStatic(String name) throws ELException {
int i = name.lastIndexOf('.');
if (i <= 0) {
- throw new ELException(
- "The name " + name + " is not a full static member name");
+ throw new ELException("The name " + name + " is not a full static member name");
}
- String memberName = name.substring(i+1);
+ String memberName = name.substring(i + 1);
String className = name.substring(0, i);
staticNameMap.put(memberName, className);
}
/**
* Import a class.
+ *
* @param name The full class name of the class to be imported
* @throws ELException if the name does not include a ".".
*/
public void importClass(String name) throws ELException {
int i = name.lastIndexOf('.');
if (i <= 0) {
- throw new ELException(
- "The name " + name + " is not a full class name");
+ throw new ELException("The name " + name + " is not a full class name");
}
- String className = name.substring(i+1);
+ String className = name.substring(i + 1);
classNameMap.put(className, name);
}
/**
* Import all the classes in a package.
+ *
* @param packageName The package name to be imported
*/
public void importPackage(String packageName) {
@@ -86,11 +84,9 @@
* Resolve a class name.
*
* @param name The name of the class (without package name) to be resolved.
- * @return If the class has been imported previously, with
- * {@link #importClass} or {@link #importPackage}, then its
- * Class instance. Otherwise <code>null</code>.
- * @throws ELException if the class is abstract or is an interface, or
- * not public.
+ * @return If the class has been imported previously, with {@link #importClass} or {@link #importPackage}, then its
+ * Class instance. Otherwise <code>null</code>.
+ * @throws ELException if the class is abstract or is an interface, or not public.
*/
public Class<?> resolveClass(String name) {
@@ -99,9 +95,9 @@
return resolveClassFor(className);
}
- for (String packageName: packages) {
+ for (String packageName : packages) {
String fullClassName = packageName + "." + name;
- Class<?>c = resolveClassFor(fullClassName);
+ Class<?> c = resolveClassFor(fullClassName);
if (c != null) {
classNameMap.put(name, fullClassName);
return c;
@@ -113,14 +109,10 @@
/**
* Resolve a static field or method name.
*
- * @param name The name of the member(without package and class name)
- * to be resolved.
- * @return If the field or method has been imported previously, with
- * {@link #importStatic}, then the class object representing the class that
- * declares the static field or method.
- * Otherwise <code>null</code>.
- * @throws ELException if the class is not public, or is abstract or
- * is an interface.
+ * @param name The name of the member(without package and class name) to be resolved.
+ * @return If the field or method has been imported previously, with {@link #importStatic}, then the class object
+ * representing the class that declares the static field or method. Otherwise <code>null</code>.
+ * @throws ELException if the class is not public, or is abstract or is an interface.
*/
public Class<?> resolveStatic(String name) {
String className = staticNameMap.get(name);
@@ -158,8 +150,7 @@
}
private void checkModifiers(int modifiers) {
- if (Modifier.isAbstract(modifiers) || Modifier.isInterface(modifiers)
- || ! Modifier.isPublic((modifiers))) {
+ if (Modifier.isAbstract(modifiers) || Modifier.isInterface(modifiers) || !Modifier.isPublic((modifiers))) {
throw new ELException("Imported class must be public, and cannot be abstract or an interface");
}
}
diff --git a/api/src/main/java/javax/el/LambdaExpression.java b/api/src/main/java/javax/el/LambdaExpression.java
index 0cfd911..c23654d 100644
--- a/api/src/main/java/javax/el/LambdaExpression.java
+++ b/api/src/main/java/javax/el/LambdaExpression.java
@@ -24,27 +24,21 @@
/**
* Encapsulates a parameterized {@link ValueExpression}.
*
- * <p>A <code>LambdaExpression</code> is a representation of the EL Lambda
- * expression syntax. It consists of a list of the formal parameters and a
- * body, represented by a {@link ValueExpression}.
- * The body can be any valid <code>Expression</code>, including another
- * <code>LambdaExpression</code>.
+ * <p>
+ * A <code>LambdaExpression</code> is a representation of the EL Lambda expression syntax. It consists of a list of the
+ * formal parameters and a body, represented by a {@link ValueExpression}. The body can be any valid
+ * <code>Expression</code>, including another <code>LambdaExpression</code>.
*
* <p>
- * A <code>LambdaExpression</code> is created when an EL expression containing
- * a Lambda expression is evaluated.
+ * A <code>LambdaExpression</code> is created when an EL expression containing a Lambda expression is evaluated.
*
* <p>
- * A <code>LambdaExpression</code> can be invoked by calling
- * {@link LambdaExpression#invoke}, with
- * an {@link javax.el.ELContext} and a list of the actual arguments.
- * Alternately, a <code>LambdaExpression</code> can be invoked without passing
- * a <code>ELContext</code>, in which case the <code>ELContext</code> previously
- * set by calling {@link LambdaExpression#setELContext} will be used.
- * The evaluation of the <code>ValueExpression</code> in the body uses the
- * {@link ELContext} to resolve references to the parameters, and to evaluate
- * the lambda expression.
- * The result of the evaluation is returned.
+ * A <code>LambdaExpression</code> can be invoked by calling {@link LambdaExpression#invoke}, with an
+ * {@link javax.el.ELContext} and a list of the actual arguments. Alternately, a <code>LambdaExpression</code> can be
+ * invoked without passing a <code>ELContext</code>, in which case the <code>ELContext</code> previously set by calling
+ * {@link LambdaExpression#setELContext} will be used. The evaluation of the <code>ValueExpression</code> in the body
+ * uses the {@link ELContext} to resolve references to the parameters, and to evaluate the lambda expression. The result
+ * of the evaluation is returned.
*
* @see ELContext#getLambdaArgument
* @see ELContext#enterLambdaScope
@@ -61,22 +55,20 @@
/**
* Creates a new LambdaExpression.
- * @param formalParameters The list of String representing the formal
- * parameters.
- * @param expression The <code>ValueExpression</code> representing the
- * body.
+ *
+ * @param formalParameters The list of String representing the formal parameters.
+ * @param expression The <code>ValueExpression</code> representing the body.
*/
- public LambdaExpression (List<String> formalParameters,
- ValueExpression expression) {
+ public LambdaExpression(List<String> formalParameters, ValueExpression expression) {
this.formalParameters = formalParameters;
this.expression = expression;
this.envirArgs = new HashMap<String, Object>();
}
/**
- * Set the ELContext to use in evaluating the LambdaExpression.
- * The ELContext must to be set prior to the invocation of the LambdaExpression,
- * unless it is supplied with {@link LambdaExpression#invoke}.
+ * Set the ELContext to use in evaluating the LambdaExpression. The ELContext must to be set prior to the invocation of
+ * the LambdaExpression, unless it is supplied with {@link LambdaExpression#invoke}.
+ *
* @param context The ELContext to use in evaluating the LambdaExpression.
*/
public void setELContext(ELContext context) {
@@ -85,37 +77,35 @@
/**
* Invoke the encapsulated Lambda expression.
- * <p> The supplied arguments are matched, in
- * the same order, to the formal parameters. If there are more arguments
- * than the formal parameters, the extra arguments are ignored. If there
- * are less arguments than the formal parameters, an
- * <code>ELException</code> is thrown.</p>
+ * <p>
+ * The supplied arguments are matched, in the same order, to the formal parameters. If there are more arguments than the
+ * formal parameters, the extra arguments are ignored. If there are less arguments than the formal parameters, an
+ * <code>ELException</code> is thrown.
+ * </p>
*
- * <p>The actual Lambda arguments are added to the ELContext and are
- * available during the evaluation of the Lambda expression. They are
- * removed after the evaluation.</p>
+ * <p>
+ * The actual Lambda arguments are added to the ELContext and are available during the evaluation of the Lambda
+ * expression. They are removed after the evaluation.
+ * </p>
*
- * @param elContext The ELContext used for the evaluation of the expression
- * The ELContext set by {@link #setELContext} is ignored.
- * @param args The arguments to invoke the Lambda expression. For calls with
- * no arguments, an empty array must be provided. A Lambda argument
- * can be <code>null</code>.
+ * @param elContext The ELContext used for the evaluation of the expression The ELContext set by {@link #setELContext}
+ * is ignored.
+ * @param args The arguments to invoke the Lambda expression. For calls with no arguments, an empty array must be
+ * provided. A Lambda argument can be <code>null</code>.
* @return The result of invoking the Lambda expression
* @throws ELException if not enough arguments are provided
* @throws NullPointerException is elContext is null
*/
- public Object invoke(ELContext elContext, Object... args)
- throws ELException {
+ public Object invoke(ELContext elContext, Object... args) throws ELException {
int i = 0;
Map<String, Object> lambdaArgs = new HashMap<String, Object>();
// First get arguments injected from the outter lambda, if any
lambdaArgs.putAll(envirArgs);
- for (String fParam: formalParameters) {
+ for (String fParam : formalParameters) {
if (i >= args.length) {
- throw new ELException("Expected Argument " + fParam +
- " missing in Lambda Expression");
+ throw new ELException("Expected Argument " + fParam + " missing in Lambda Expression");
}
lambdaArgs.put(fParam, args[i++]);
}
@@ -124,10 +114,10 @@
Object ret = expression.getValue(elContext);
// If the result of evaluating the body is another LambdaExpression,
- // whose body has not been evaluated yet. (A LambdaExpression is
+ // whose body has not been evaluated yet. (A LambdaExpression is
// evaluated iff when its invoke method is called.) The current lambda
// arguments may be needed in that body when it is evaluated later,
- // after the current lambda exits. To make these arguments available
+ // after the current lambda exits. To make these arguments available
// then, they are injected into it.
if (ret instanceof LambdaExpression) {
((LambdaExpression) ret).envirArgs.putAll(lambdaArgs);
@@ -138,22 +128,21 @@
/**
* Invoke the encapsulated Lambda expression.
- * <p> The supplied arguments are matched, in
- * the same order, to the formal parameters. If there are more arguments
- * than the formal parameters, the extra arguments are ignored. If there
- * are less arguments than the formal parameters, an
- * <code>ELException</code> is thrown.</p>
+ * <p>
+ * The supplied arguments are matched, in the same order, to the formal parameters. If there are more arguments than the
+ * formal parameters, the extra arguments are ignored. If there are less arguments than the formal parameters, an
+ * <code>ELException</code> is thrown.
+ * </p>
*
- * <p>The actual Lambda arguments are added to the ELContext and are
- * available during the evaluation of the Lambda expression. They are
- * removed after the evaluation.</p>
+ * <p>
+ * The actual Lambda arguments are added to the ELContext and are available during the evaluation of the Lambda
+ * expression. They are removed after the evaluation.
+ * </p>
*
- * The ELContext set by {@link LambdaExpression#setELContext} is used in
- * the evaluation of the lambda Expression.
+ * The ELContext set by {@link LambdaExpression#setELContext} is used in the evaluation of the lambda Expression.
*
- * @param args The arguments to invoke the Lambda expression. For calls with
- * no arguments, an empty array must be provided. A Lambda argument
- * can be <code>null</code>.
+ * @param args The arguments to invoke the Lambda expression. For calls with no arguments, an empty array must be
+ * provided. A Lambda argument can be <code>null</code>.
* @return The result of invoking the Lambda expression
* @throws ELException if not enough arguments are provided
*/
diff --git a/api/src/main/java/javax/el/ListELResolver.java b/api/src/main/java/javax/el/ListELResolver.java
index 0b5ee1e..a4ca95a 100644
--- a/api/src/main/java/javax/el/ListELResolver.java
+++ b/api/src/main/java/javax/el/ListELResolver.java
@@ -23,23 +23,23 @@
import java.util.ArrayList;
import java.beans.FeatureDescriptor;
-
/**
* Defines property resolution behavior on instances of {@link java.util.List}.
*
- * <p>This resolver handles base objects of type <code>java.util.List</code>.
- * It accepts any object as a property and coerces that object into an
- * integer index into the list. The resulting value is the value in the list
- * at that index.</p>
+ * <p>
+ * This resolver handles base objects of type <code>java.util.List</code>. It accepts any object as a property and
+ * coerces that object into an integer index into the list. The resulting value is the value in the list at that index.
+ * </p>
*
- * <p>This resolver can be constructed in read-only mode, which means that
- * {@link #isReadOnly} will always return <code>true</code> and
- * {@link #setValue} will always throw
- * <code>PropertyNotWritableException</code>.</p>
+ * <p>
+ * This resolver can be constructed in read-only mode, which means that {@link #isReadOnly} will always return
+ * <code>true</code> and {@link #setValue} will always throw <code>PropertyNotWritableException</code>.
+ * </p>
*
- * <p><code>ELResolver</code>s are combined together using
- * {@link CompositeELResolver}s, to define rich semantics for evaluating
- * an expression. See the javadocs for {@link ELResolver} for details.</p>
+ * <p>
+ * <code>ELResolver</code>s are combined together using {@link CompositeELResolver}s, to define rich semantics for
+ * evaluating an expression. See the javadocs for {@link ELResolver} for details.
+ * </p>
*
* @see CompositeELResolver
* @see ELResolver
@@ -56,50 +56,40 @@
}
/**
- * Creates a new <code>ListELResolver</code> whose read-only status is
- * determined by the given parameter.
+ * Creates a new <code>ListELResolver</code> whose read-only status is determined by the given parameter.
*
- * @param isReadOnly <code>true</code> if this resolver cannot modify
- * lists; <code>false</code> otherwise.
+ * @param isReadOnly <code>true</code> if this resolver cannot modify lists; <code>false</code> otherwise.
*/
public ListELResolver(boolean isReadOnly) {
this.isReadOnly = isReadOnly;
}
/**
- * If the base object is a list, returns the most general acceptable type
- * for a value in this list.
+ * If the base object is a list, returns the most general acceptable type for a value in this list.
*
- * <p>If the base is a <code>List</code>, the <code>propertyResolved</code>
- * property of the <code>ELContext</code> object must be set to
- * <code>true</code> by this resolver, before returning. If this property
- * is not <code>true</code> after this method is called, the caller
- * should ignore the return value.</p>
+ * <p>
+ * If the base is a <code>List</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>Assuming the base is a <code>List</code>, this method will always
- * return <code>Object.class</code>. This is because <code>List</code>s
- * accept any object as an element.</p>
+ * <p>
+ * Assuming the base is a <code>List</code>, this method will always return <code>Object.class</code>. This is because
+ * <code>List</code>s accept any object as an element.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The list to analyze. Only bases of type <code>List</code>
- * are handled by this resolver.
- * @param property The index of the element in the list to return the
- * acceptable type for. Will be coerced into an integer, but
- * otherwise ignored by this resolver.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the most general acceptable type; otherwise undefined.
- * @throws PropertyNotFoundException if the given index is out of
- * bounds for this list.
+ * @param base The list to analyze. Only bases of type <code>List</code> are handled by this resolver.
+ * @param property The index of the element in the list to return the acceptable type for. Will be coerced into an
+ * integer, but otherwise ignored by this resolver.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the most general acceptable type; otherwise undefined.
+ * @throws PropertyNotFoundException if the given index is out of bounds for this list.
* @throws NullPointerException if context is <code>null</code>
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public Class<?> getType(ELContext context,
- Object base,
- Object property) {
+ public Class<?> getType(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
@@ -111,45 +101,34 @@
int index = toInteger(property);
if (index < 0 || index >= list.size()) {
throw new PropertyNotFoundException();
- }
+ }
return Object.class;
}
return null;
}
/**
- * If the base object is a list, returns the value at the given index.
- * The index is specified by the <code>property</code> argument, and
- * coerced into an integer. If the coercion could not be performed,
- * an <code>IllegalArgumentException</code> is thrown. If the index is
- * out of bounds, <code>null</code> is returned.
+ * If the base object is a list, returns the value at the given index. The index is specified by the
+ * <code>property</code> argument, and coerced into an integer. If the coercion could not be performed, an
+ * <code>IllegalArgumentException</code> is thrown. If the index is out of bounds, <code>null</code> is returned.
*
- * <p>If the base is a <code>List</code>, the <code>propertyResolved</code>
- * property of the <code>ELContext</code> object must be set to
- * <code>true</code> by this resolver, before returning. If this property
- * is not <code>true</code> after this method is called, the caller
- * should ignore the return value.</p>
+ * <p>
+ * If the base is a <code>List</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The list to be analyzed. Only bases of type
- * <code>List</code> are handled by this resolver.
- * @param property The index of the value to be returned. Will be coerced
- * into an integer.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the value at the given index or <code>null</code>
- * if the index was out of bounds. Otherwise, undefined.
- * @throws IllegalArgumentException if the property could not be coerced
- * into an integer.
+ * @param base The list to be analyzed. Only bases of type <code>List</code> are handled by this resolver.
+ * @param property The index of the value to be returned. Will be coerced into an integer.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the value at the given index or <code>null</code> if the index was out of bounds. Otherwise, undefined.
+ * @throws IllegalArgumentException if the property could not be coerced into an integer.
* @throws NullPointerException if context is <code>null</code>.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public Object getValue(ELContext context,
- Object base,
- Object property) {
+ public Object getValue(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
@@ -161,65 +140,52 @@
int index = toInteger(property);
if (index < 0 || index >= list.size()) {
return null;
- }
+ }
return list.get(index);
}
return null;
}
/**
- * If the base object is a list, attempts to set the value at the
- * given index with the given value. The index is specified by the
- * <code>property</code> argument, and coerced into an integer. If the
- * coercion could not be performed, an
- * <code>IllegalArgumentException</code> is thrown. If the index is
- * out of bounds, a <code>PropertyNotFoundException</code> is thrown.
+ * If the base object is a list, attempts to set the value at the given index with the given value. The index is
+ * specified by the <code>property</code> argument, and coerced into an integer. If the coercion could not be performed,
+ * an <code>IllegalArgumentException</code> is thrown. If the index is out of bounds, a
+ * <code>PropertyNotFoundException</code> is thrown.
*
- * <p>If the base is a <code>List</code>, the <code>propertyResolved</code>
- * property of the <code>ELContext</code> object must be set to
- * <code>true</code> by this resolver, before returning. If this property
- * is not <code>true</code> after this method is called, the caller
- * can safely assume no value was set.</p>
+ * <p>
+ * If the base is a <code>List</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller can safely assume no value was set.
+ * </p>
*
- * <p>If this resolver was constructed in read-only mode, this method will
- * always throw <code>PropertyNotWritableException</code>.</p>
+ * <p>
+ * If this resolver was constructed in read-only mode, this method will always throw
+ * <code>PropertyNotWritableException</code>.
+ * </p>
*
- * <p>If a <code>List</code> was created using
- * {@link java.util.Collections#unmodifiableList}, this method must
- * throw <code>PropertyNotWritableException</code>. Unfortunately,
- * there is no Collections API method to detect this. However, an
- * implementation can create a prototype unmodifiable <code>List</code>
- * and query its runtime type to see if it matches the runtime type of
- * the base object as a workaround.</p>
+ * <p>
+ * If a <code>List</code> was created using {@link java.util.Collections#unmodifiableList}, this method must throw
+ * <code>PropertyNotWritableException</code>. Unfortunately, there is no Collections API method to detect this. However,
+ * an implementation can create a prototype unmodifiable <code>List</code> and query its runtime type to see if it
+ * matches the runtime type of the base object as a workaround.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The list to be modified. Only bases of type
- * <code>List</code> are handled by this resolver.
- * @param property The index of the value to be set. Will be coerced
- * into an integer.
+ * @param base The list to be modified. Only bases of type <code>List</code> are handled by this resolver.
+ * @param property The index of the value to be set. Will be coerced into an integer.
* @param val The value to be set at the given index.
- * @throws ClassCastException if the class of the specified element
- * prevents it from being added to this list.
- * @throws NullPointerException if context is <code>null</code>, or
- * if the value is <code>null</code> and this <code>List</code>
- * does not support <code>null</code> elements.
- * @throws IllegalArgumentException if the property could not be coerced
- * into an integer, or if some aspect of the specified element
- * prevents it from being added to this list.
- * @throws PropertyNotWritableException if this resolver was constructed
- * in read-only mode, or if the set operation is not supported by
- * the underlying list.
- * @throws PropertyNotFoundException if the given index is out of
- * bounds for this list.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ClassCastException if the class of the specified element prevents it from being added to this list.
+ * @throws NullPointerException if context is <code>null</code>, or if the value is <code>null</code> and this
+ * <code>List</code> does not support <code>null</code> elements.
+ * @throws IllegalArgumentException if the property could not be coerced into an integer, or if some aspect of the
+ * specified element prevents it from being added to this list.
+ * @throws PropertyNotWritableException if this resolver was constructed in read-only mode, or if the set operation is
+ * not supported by the underlying list.
+ * @throws PropertyNotFoundException if the given index is out of bounds for this list.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public void setValue(ELContext context,
- Object base,
- Object property,
- Object val) {
+ public void setValue(ELContext context, Object base, Object property, Object val) {
if (context == null) {
throw new NullPointerException();
@@ -250,52 +216,41 @@
}
}
- static private Class<?> theUnmodifiableListClass =
- Collections.unmodifiableList(new ArrayList<Object>()).getClass();
+ static private Class<?> theUnmodifiableListClass = Collections.unmodifiableList(new ArrayList<Object>()).getClass();
/**
- * If the base object is a list, returns whether a call to
- * {@link #setValue} will always fail.
+ * If the base object is a list, returns whether a call to {@link #setValue} will always fail.
*
- * <p>If the base is a <code>List</code>, the <code>propertyResolved</code>
- * property of the <code>ELContext</code> object must be set to
- * <code>true</code> by this resolver, before returning. If this property
- * is not <code>true</code> after this method is called, the caller
- * should ignore the return value.</p>
+ * <p>
+ * If the base is a <code>List</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>If this resolver was constructed in read-only mode, this method will
- * always return <code>true</code>.</p>
+ * <p>
+ * If this resolver was constructed in read-only mode, this method will always return <code>true</code>.
+ * </p>
*
- * <p>If a <code>List</code> was created using
- * {@link java.util.Collections#unmodifiableList}, this method must
- * return <code>true</code>. Unfortunately, there is no Collections API
- * method to detect this. However, an implementation can create a
- * prototype unmodifiable <code>List</code> and query its runtime type
- * to see if it matches the runtime type of the base object as a
- * workaround.</p>
+ * <p>
+ * If a <code>List</code> was created using {@link java.util.Collections#unmodifiableList}, this method must return
+ * <code>true</code>. Unfortunately, there is no Collections API method to detect this. However, an implementation can
+ * create a prototype unmodifiable <code>List</code> and query its runtime type to see if it matches the runtime type of
+ * the base object as a workaround.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The list to analyze. Only bases of type <code>List</code>
- * are handled by this resolver.
- * @param property The index of the element in the list to return the
- * acceptable type for. Will be coerced into an integer, but
- * otherwise ignored by this resolver.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * <code>true</code> if calling the <code>setValue</code> method
- * will always fail or <code>false</code> if it is possible that
- * such a call may succeed; otherwise undefined.
- * @throws PropertyNotFoundException if the given index is out of
- * bounds for this list.
+ * @param base The list to analyze. Only bases of type <code>List</code> are handled by this resolver.
+ * @param property The index of the element in the list to return the acceptable type for. Will be coerced into an
+ * integer, but otherwise ignored by this resolver.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * <code>true</code> if calling the <code>setValue</code> method will always fail or <code>false</code> if it is
+ * possible that such a call may succeed; otherwise undefined.
+ * @throws PropertyNotFoundException if the given index is out of bounds for this list.
* @throws NullPointerException if context is <code>null</code>
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
- public boolean isReadOnly(ELContext context,
- Object base,
- Object property) {
+ public boolean isReadOnly(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
@@ -307,53 +262,47 @@
int index = toInteger(property);
if (index < 0 || index >= list.size()) {
throw new PropertyNotFoundException();
- }
+ }
return list.getClass() == theUnmodifiableListClass || isReadOnly;
}
return false;
}
/**
- * Always returns <code>null</code>, since there is no reason to
- * iterate through set set of all integers.
+ * Always returns <code>null</code>, since there is no reason to iterate through set set of all integers.
*
- * <p>The {@link #getCommonPropertyType} method returns sufficient
- * information about what properties this resolver accepts.</p>
+ * <p>
+ * The {@link #getCommonPropertyType} method returns sufficient information about what properties this resolver accepts.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The list. Only bases of type <code>List</code> are
- * handled by this resolver.
+ * @param base The list. Only bases of type <code>List</code> are handled by this resolver.
* @return <code>null</code>.
*/
- public Iterator<FeatureDescriptor> getFeatureDescriptors(
- ELContext context,
- Object base) {
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return null;
}
/**
- * If the base object is a list, returns the most general type that
- * this resolver accepts for the <code>property</code> argument.
- * Otherwise, returns <code>null</code>.
+ * If the base object is a list, returns the most general type that this resolver accepts for the <code>property</code>
+ * argument. Otherwise, returns <code>null</code>.
*
- * <p>Assuming the base is a <code>List</code>, this method will always
- * return <code>Integer.class</code>. This is because <code>List</code>s
- * accept integers as their index.</p>
+ * <p>
+ * Assuming the base is a <code>List</code>, this method will always return <code>Integer.class</code>. This is because
+ * <code>List</code>s accept integers as their index.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The list to analyze. Only bases of type <code>List</code>
- * are handled by this resolver.
- * @return <code>null</code> if base is not a <code>List</code>; otherwise
- * <code>Integer.class</code>.
+ * @param base The list to analyze. Only bases of type <code>List</code> are handled by this resolver.
+ * @return <code>null</code> if base is not a <code>List</code>; otherwise <code>Integer.class</code>.
*/
- public Class<?> getCommonPropertyType(ELContext context,
- Object base) {
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
if (base != null && base instanceof List) {
return Integer.class;
}
return null;
}
-
+
private int toInteger(Object p) {
if (p instanceof Integer) {
return ((Integer) p).intValue();
@@ -372,4 +321,3 @@
private boolean isReadOnly;
}
-
diff --git a/api/src/main/java/javax/el/MapELResolver.java b/api/src/main/java/javax/el/MapELResolver.java
index 6af6f4b..fadc0dd 100644
--- a/api/src/main/java/javax/el/MapELResolver.java
+++ b/api/src/main/java/javax/el/MapELResolver.java
@@ -28,19 +28,20 @@
/**
* Defines property resolution behavior on instances of {@link java.util.Map}.
*
- * <p>This resolver handles base objects of type <code>java.util.Map</code>.
- * It accepts any object as a property and uses that object as a key in
- * the map. The resulting value is the value in the map that is associated with
- * that key.</p>
+ * <p>
+ * This resolver handles base objects of type <code>java.util.Map</code>. It accepts any object as a property and uses
+ * that object as a key in the map. The resulting value is the value in the map that is associated with that key.
+ * </p>
*
- * <p>This resolver can be constructed in read-only mode, which means that
- * {@link #isReadOnly} will always return <code>true</code> and
- * {@link #setValue} will always throw
- * <code>PropertyNotWritableException</code>.</p>
+ * <p>
+ * This resolver can be constructed in read-only mode, which means that {@link #isReadOnly} will always return
+ * <code>true</code> and {@link #setValue} will always throw <code>PropertyNotWritableException</code>.
+ * </p>
*
- * <p><code>ELResolver</code>s are combined together using
- * {@link CompositeELResolver}s, to define rich semantics for evaluating
- * an expression. See the javadocs for {@link ELResolver} for details.</p>
+ * <p>
+ * <code>ELResolver</code>s are combined together using {@link CompositeELResolver}s, to define rich semantics for
+ * evaluating an expression. See the javadocs for {@link ELResolver} for details.
+ * </p>
*
* @see CompositeELResolver
* @see ELResolver
@@ -57,48 +58,39 @@
}
/**
- * Creates a new <code>MapELResolver</code> whose read-only status is
- * determined by the given parameter.
+ * Creates a new <code>MapELResolver</code> whose read-only status is determined by the given parameter.
*
- * @param isReadOnly <code>true</code> if this resolver cannot modify
- * maps; <code>false</code> otherwise.
+ * @param isReadOnly <code>true</code> if this resolver cannot modify maps; <code>false</code> otherwise.
*/
public MapELResolver(boolean isReadOnly) {
this.isReadOnly = isReadOnly;
}
/**
- * If the base object is a map, returns the most general acceptable type
- * for a value in this map.
+ * If the base object is a map, returns the most general acceptable type for a value in this map.
*
- * <p>If the base is a <code>Map</code>, the <code>propertyResolved</code>
- * property of the <code>ELContext</code> object must be set to
- * <code>true</code> by this resolver, before returning. If this property
- * is not <code>true</code> after this method is called, the caller
- * should ignore the return value.</p>
+ * <p>
+ * If the base is a <code>Map</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>Assuming the base is a <code>Map</code>, this method will always
- * return <code>Object.class</code>. This is because <code>Map</code>s
- * accept any object as the value for a given key.</p>
+ * <p>
+ * Assuming the base is a <code>Map</code>, this method will always return <code>Object.class</code>. This is because
+ * <code>Map</code>s accept any object as the value for a given key.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The map to analyze. Only bases of type <code>Map</code>
- * are handled by this resolver.
- * @param property The key to return the acceptable type for.
- * Ignored by this resolver.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the most general acceptable type; otherwise undefined.
+ * @param base The map to analyze. Only bases of type <code>Map</code> are handled by this resolver.
+ * @param property The key to return the acceptable type for. Ignored by this resolver.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the most general acceptable type; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public Class<?> getType(ELContext context,
- Object base,
- Object property) {
+ public Class<?> getType(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
@@ -112,43 +104,34 @@
}
/**
- * If the base object is a map, returns the value associated with the
- * given key, as specified by the <code>property</code> argument. If the
- * key was not found, <code>null</code> is returned.
+ * If the base object is a map, returns the value associated with the given key, as specified by the
+ * <code>property</code> argument. If the key was not found, <code>null</code> is returned.
*
- * <p>If the base is a <code>Map</code>, the <code>propertyResolved</code>
- * property of the <code>ELContext</code> object must be set to
- * <code>true</code> by this resolver, before returning. If this property
- * is not <code>true</code> after this method is called, the caller
- * should ignore the return value.</p>
+ * <p>
+ * If the base is a <code>Map</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>Just as in {@link java.util.Map#get}, just because <code>null</code>
- * is returned doesn't mean there is no mapping for the key; it's also
- * possible that the <code>Map</code> explicitly maps the key to
- * <code>null</code>.</p>
+ * <p>
+ * Just as in {@link java.util.Map#get}, just because <code>null</code> is returned doesn't mean there is no mapping for
+ * the key; it's also possible that the <code>Map</code> explicitly maps the key to <code>null</code>.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The map to be analyzed. Only bases of type <code>Map</code>
- * are handled by this resolver.
+ * @param base The map to be analyzed. Only bases of type <code>Map</code> are handled by this resolver.
* @param property The key whose associated value is to be returned.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the value associated with the given key or <code>null</code>
- * if the key was not found. Otherwise, undefined.
- * @throws ClassCastException if the key is of an inappropriate type
- * for this map (optionally thrown by the underlying <code>Map</code>).
- * @throws NullPointerException if context is <code>null</code>, or if
- * the key is null and this map does not permit null keys (the
- * latter is optionally thrown by the underlying <code>Map</code>).
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the value associated with the given key or <code>null</code> if the key was not found. Otherwise, undefined.
+ * @throws ClassCastException if the key is of an inappropriate type for this map (optionally thrown by the underlying
+ * <code>Map</code>).
+ * @throws NullPointerException if context is <code>null</code>, or if the key is null and this map does not permit null
+ * keys (the latter is optionally thrown by the underlying <code>Map</code>).
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public Object getValue(ELContext context,
- Object base,
- Object property) {
+ public Object getValue(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
@@ -162,56 +145,45 @@
return null;
}
- static private Class<?> theUnmodifiableMapClass =
- Collections.unmodifiableMap(new HashMap<Object, Object>()).getClass();
+ static private Class<?> theUnmodifiableMapClass = Collections.unmodifiableMap(new HashMap<Object, Object>()).getClass();
/**
- * If the base object is a map, attempts to set the value associated with
- * the given key, as specified by the <code>property</code> argument.
+ * If the base object is a map, attempts to set the value associated with the given key, as specified by the
+ * <code>property</code> argument.
*
- * <p>If the base is a <code>Map</code>, the <code>propertyResolved</code>
- * property of the <code>ELContext</code> object must be set to
- * <code>true</code> by this resolver, before returning. If this property
- * is not <code>true</code> after this method is called, the caller
- * can safely assume no value was set.</p>
+ * <p>
+ * If the base is a <code>Map</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller can safely assume no value was set.
+ * </p>
*
- * <p>If this resolver was constructed in read-only mode, this method will
- * always throw <code>PropertyNotWritableException</code>.</p>
+ * <p>
+ * If this resolver was constructed in read-only mode, this method will always throw
+ * <code>PropertyNotWritableException</code>.
+ * </p>
*
- * <p>If a <code>Map</code> was created using
- * {@link java.util.Collections#unmodifiableMap}, this method must
- * throw <code>PropertyNotWritableException</code>. Unfortunately,
- * there is no Collections API method to detect this. However, an
- * implementation can create a prototype unmodifiable <code>Map</code>
- * and query its runtime type to see if it matches the runtime type of
- * the base object as a workaround.</p>
+ * <p>
+ * If a <code>Map</code> was created using {@link java.util.Collections#unmodifiableMap}, this method must throw
+ * <code>PropertyNotWritableException</code>. Unfortunately, there is no Collections API method to detect this. However,
+ * an implementation can create a prototype unmodifiable <code>Map</code> and query its runtime type to see if it
+ * matches the runtime type of the base object as a workaround.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The map to be modified. Only bases of type <code>Map</code>
- * are handled by this resolver.
- * @param property The key with which the specified value is to be
- * associated.
+ * @param base The map to be modified. Only bases of type <code>Map</code> are handled by this resolver.
+ * @param property The key with which the specified value is to be associated.
* @param val The value to be associated with the specified key.
- * @throws ClassCastException if the class of the specified key or
- * value prevents it from being stored in this map.
- * @throws NullPointerException if context is <code>null</code>, or if
- * this map does not permit <code>null</code> keys or values, and
- * the specified key or value is <code>null</code>.
- * @throws IllegalArgumentException if some aspect of this key or
- * value prevents it from being stored in this map.
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
- * @throws PropertyNotWritableException if this resolver was constructed
- * in read-only mode, or if the put operation is not supported by
- * the underlying map.
+ * @throws ClassCastException if the class of the specified key or value prevents it from being stored in this map.
+ * @throws NullPointerException if context is <code>null</code>, or if this map does not permit <code>null</code> keys
+ * or values, and the specified key or value is <code>null</code>.
+ * @throws IllegalArgumentException if some aspect of this key or value prevents it from being stored in this map.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
+ * @throws PropertyNotWritableException if this resolver was constructed in read-only mode, or if the put operation is
+ * not supported by the underlying map.
*/
@Override
- public void setValue(ELContext context,
- Object base,
- Object property,
- Object val) {
+ public void setValue(ELContext context, Object base, Object property, Object val) {
if (context == null) {
throw new NullPointerException();
@@ -221,7 +193,7 @@
context.setPropertyResolved(base, property);
// The cast is safe
@SuppressWarnings("unchecked")
- Map<Object, Object> map = (Map)base;
+ Map<Object, Object> map = (Map) base;
if (isReadOnly || map.getClass() == theUnmodifiableMapClass) {
throw new PropertyNotWritableException();
}
@@ -234,46 +206,37 @@
}
/**
- * If the base object is a map, returns whether a call to
- * {@link #setValue} will always fail.
+ * If the base object is a map, returns whether a call to {@link #setValue} will always fail.
*
- * <p>If the base is a <code>Map</code>, the <code>propertyResolved</code>
- * property of the <code>ELContext</code> object must be set to
- * <code>true</code> by this resolver, before returning. If this property
- * is not <code>true</code> after this method is called, the caller
- * should ignore the return value.</p>
+ * <p>
+ * If the base is a <code>Map</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object
+ * must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after
+ * this method is called, the caller should ignore the return value.
+ * </p>
*
- * <p>If this resolver was constructed in read-only mode, this method will
- * always return <code>true</code>.</p>
+ * <p>
+ * If this resolver was constructed in read-only mode, this method will always return <code>true</code>.
+ * </p>
*
- * <p>If a <code>Map</code> was created using
- * {@link java.util.Collections#unmodifiableMap}, this method must
- * return <code>true</code>. Unfortunately, there is no Collections API
- * method to detect this. However, an implementation can create a
- * prototype unmodifiable <code>Map</code> and query its runtime type
- * to see if it matches the runtime type of the base object as a
- * workaround.</p>
+ * <p>
+ * If a <code>Map</code> was created using {@link java.util.Collections#unmodifiableMap}, this method must return
+ * <code>true</code>. Unfortunately, there is no Collections API method to detect this. However, an implementation can
+ * create a prototype unmodifiable <code>Map</code> and query its runtime type to see if it matches the runtime type of
+ * the base object as a workaround.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The map to analyze. Only bases of type <code>Map</code>
- * are handled by this resolver.
- * @param property The key to return the read-only status for.
- * Ignored by this resolver.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * <code>true</code> if calling the <code>setValue</code> method
- * will always fail or <code>false</code> if it is possible that
- * such a call may succeed; otherwise undefined.
+ * @param base The map to analyze. Only bases of type <code>Map</code> are handled by this resolver.
+ * @param property The key to return the read-only status for. Ignored by this resolver.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * <code>true</code> if calling the <code>setValue</code> method will always fail or <code>false</code> if it is
+ * possible that such a call may succeed; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>
- * @throws ELException if an exception was thrown while performing
- * the property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
- public boolean isReadOnly(ELContext context,
- Object base,
- Object property) {
+ public boolean isReadOnly(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
@@ -288,48 +251,38 @@
}
/**
- * If the base object is a map, returns an <code>Iterator</code>
- * containing the set of keys available in the <code>Map</code>.
- * Otherwise, returns <code>null</code>.
+ * If the base object is a map, returns an <code>Iterator</code> containing the set of keys available in the
+ * <code>Map</code>. Otherwise, returns <code>null</code>.
*
* <p>
- * The <code>Iterator</code> returned must contain zero or more
- * instances of {@link java.beans.FeatureDescriptor}. Each info object
- * contains information about a key in the Map, and is initialized as
- * follows:
+ * The <code>Iterator</code> returned must contain zero or more instances of {@link java.beans.FeatureDescriptor}. Each
+ * info object contains information about a key in the Map, and is initialized as follows:
* <ul>
- * <li>displayName - The return value of calling the
- * <code>toString</code> method on this key, or
- * <code>"null"</code> if the key is <code>null</code>.</li>
- * <li>name - Same as displayName property.</li>
- * <li>shortDescription - Empty string</li>
- * <li>expert - <code>false</code></li>
- * <li>hidden - <code>false</code></li>
- * <li>preferred - <code>true</code></li>
+ * <li>displayName - The return value of calling the <code>toString</code> method on this key, or <code>"null"</code> if
+ * the key is <code>null</code>.</li>
+ * <li>name - Same as displayName property.</li>
+ * <li>shortDescription - Empty string</li>
+ * <li>expert - <code>false</code></li>
+ * <li>hidden - <code>false</code></li>
+ * <li>preferred - <code>true</code></li>
* </ul>
*
- * In addition, the following named attributes must be set in the
- * returned <code>FeatureDescriptor</code>s:
+ * In addition, the following named attributes must be set in the returned <code>FeatureDescriptor</code>s:
* <ul>
- * <li>{@link ELResolver#TYPE} - The return value of calling the <code>getClass()</code>
- * method on this key, or <code>null</code> if the key is
- * <code>null</code>.</li>
- * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - <code>true</code></li>
+ * <li>{@link ELResolver#TYPE} - The return value of calling the <code>getClass()</code> method on this key, or
+ * <code>null</code> if the key is <code>null</code>.</li>
+ * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - <code>true</code></li>
* </ul>
*
*
* @param context The context of this evaluation.
- * @param base The map whose keys are to be iterated over. Only bases
- * of type <code>Map</code> are handled by this resolver.
- * @return An <code>Iterator</code> containing zero or more (possibly
- * infinitely more) <code>FeatureDescriptor</code> objects, each
- * representing a key in this map, or <code>null</code> if
- * the base object is not a map.
+ * @param base The map whose keys are to be iterated over. Only bases of type <code>Map</code> are handled by this
+ * resolver.
+ * @return An <code>Iterator</code> containing zero or more (possibly infinitely more) <code>FeatureDescriptor</code>
+ * objects, each representing a key in this map, or <code>null</code> if the base object is not a map.
*/
@Override
- public Iterator<FeatureDescriptor> getFeatureDescriptors(
- ELContext context,
- Object base) {
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
if (base != null && base instanceof Map) {
Map map = (Map) base;
@@ -338,7 +291,7 @@
while (iter.hasNext()) {
Object key = iter.next();
FeatureDescriptor descriptor = new FeatureDescriptor();
- String name = (key==null)? null: key.toString();
+ String name = (key == null) ? null : key.toString();
descriptor.setName(name);
descriptor.setDisplayName(name);
descriptor.setShortDescription("");
@@ -357,23 +310,20 @@
}
/**
- * If the base object is a map, returns the most general type that
- * this resolver accepts for the <code>property</code> argument.
- * Otherwise, returns <code>null</code>.
+ * If the base object is a map, returns the most general type that this resolver accepts for the <code>property</code>
+ * argument. Otherwise, returns <code>null</code>.
*
- * <p>Assuming the base is a <code>Map</code>, this method will always
- * return <code>Object.class</code>. This is because <code>Map</code>s
- * accept any object as a key.</p>
+ * <p>
+ * Assuming the base is a <code>Map</code>, this method will always return <code>Object.class</code>. This is because
+ * <code>Map</code>s accept any object as a key.
+ * </p>
*
* @param context The context of this evaluation.
- * @param base The map to analyze. Only bases of type <code>Map</code>
- * are handled by this resolver.
- * @return <code>null</code> if base is not a <code>Map</code>; otherwise
- * <code>Object.class</code>.
+ * @param base The map to analyze. Only bases of type <code>Map</code> are handled by this resolver.
+ * @return <code>null</code> if base is not a <code>Map</code>; otherwise <code>Object.class</code>.
*/
@Override
- public Class<?> getCommonPropertyType(ELContext context,
- Object base) {
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
if (base != null && base instanceof Map) {
return Object.class;
}
@@ -382,4 +332,3 @@
private boolean isReadOnly;
}
-
diff --git a/api/src/main/java/javax/el/MethodExpression.java b/api/src/main/java/javax/el/MethodExpression.java
index f0ae67b..3997f0b 100644
--- a/api/src/main/java/javax/el/MethodExpression.java
+++ b/api/src/main/java/javax/el/MethodExpression.java
@@ -20,111 +20,87 @@
/**
* An <code>Expression</code> that refers to a method on an object.
*
- * <p>The {@link javax.el.ExpressionFactory#createMethodExpression} method
- * can be used to parse an expression string and return a concrete instance
- * of <code>MethodExpression</code> that encapsulates the parsed expression.
- * The {@link FunctionMapper} is used at parse time, not evaluation time,
- * so one is not needed to evaluate an expression using this class.
- * However, the {@link ELContext} is needed at evaluation time.</p>
+ * <p>
+ * The {@link javax.el.ExpressionFactory#createMethodExpression} method can be used to parse an expression string and
+ * return a concrete instance of <code>MethodExpression</code> that encapsulates the parsed expression. The
+ * {@link FunctionMapper} is used at parse time, not evaluation time, so one is not needed to evaluate an expression
+ * using this class. However, the {@link ELContext} is needed at evaluation time.
+ * </p>
*
- * <p>The {@link #getMethodInfo} and {@link #invoke} methods will evaluate the
- * expression each time they are called. The {@link ELResolver} in the
- * <code>ELContext</code> is used to resolve the top-level variables and to
- * determine the behavior of the <code>.</code> and <code>[]</code>
- * operators. For any of the two methods, the
- * {@link javax.el.ELResolver#getValue}
- * method is used to resolve all properties up to but excluding the last
- * one. This provides the <code>base</code> object on which the method
- * appears. If the <code>base</code> object is null, a
- * <code>PropertyNotFoundException</code> must be thrown.
- * At the last resolution,
- * the final <code>property</code> is then coerced to a <code>String</code>,
- * which provides the name of the method to be found. A method matching the
- * name and expected parameters provided at parse time is found and it is
- * either queried or invoked (depending on the method called on this
- * <code>MethodExpression</code>).</p>
+ * <p>
+ * The {@link #getMethodInfo} and {@link #invoke} methods will evaluate the expression each time they are called. The
+ * {@link ELResolver} in the <code>ELContext</code> is used to resolve the top-level variables and to determine the
+ * behavior of the <code>.</code> and <code>[]</code> operators. For any of the two methods, the
+ * {@link javax.el.ELResolver#getValue} method is used to resolve all properties up to but excluding the last one. This
+ * provides the <code>base</code> object on which the method appears. If the <code>base</code> object is null, a
+ * <code>PropertyNotFoundException</code> must be thrown. At the last resolution, the final <code>property</code> is
+ * then coerced to a <code>String</code>, which provides the name of the method to be found. A method matching the name
+ * and expected parameters provided at parse time is found and it is either queried or invoked (depending on the method
+ * called on this <code>MethodExpression</code>).
+ * </p>
*
- * <p>See the notes about comparison, serialization and immutability in
- * the {@link Expression} javadocs.
+ * <p>
+ * See the notes about comparison, serialization and immutability in the {@link Expression} javadocs.
*
* @see ELResolver
* @see Expression
* @see ExpressionFactory
* @since JSP 2.1
*/
-public abstract class MethodExpression extends Expression
-{
+public abstract class MethodExpression extends Expression {
// Evaluation
/**
- * Evaluates the expression relative to the provided context, and
- * returns information about the actual referenced method.
+ * Evaluates the expression relative to the provided context, and returns information about the actual referenced
+ * method.
*
* @param context The context of this evaluation
- * @return an instance of <code>MethodInfo</code> containing information
- * about the method the expression evaluated to.
+ * @return an instance of <code>MethodInfo</code> containing information about the method the expression evaluated to.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if one of the property
- * resolutions failed because a specified variable or property
- * does not exist or is not readable.
+ * @throws PropertyNotFoundException if one of the property resolutions failed because a specified variable or property
+ * does not exist or is not readable.
* @throws MethodNotFoundException if no suitable method can be found.
- * @throws ELException if an exception was thrown while performing
- * property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws ELException if an exception was thrown while performing property or variable resolution. The thrown exception
+ * must be included as the cause property of this exception, if available.
*/
public abstract MethodInfo getMethodInfo(ELContext context);
/**
- * If a String literal is specified as the expression, returns the
- * String literal coerced to the expected return type of the method
- * signature. An <code>ELException</code> is thrown if
- * <code>expectedReturnType</code> is void or if the coercion of the String literal
- * to the <code>expectedReturnType</code> yields an error (see Section "1.18 Type
+ * If a String literal is specified as the expression, returns the String literal coerced to the expected return type of
+ * the method signature. An <code>ELException</code> is thrown if <code>expectedReturnType</code> is void or if the
+ * coercion of the String literal to the <code>expectedReturnType</code> yields an error (see Section "1.18 Type
* Conversion" of the EL specification).
*
- * If not a String literal, evaluates the expression
- * relative to the provided context, invokes the method that was
- * found using the supplied parameters, and returns the result of
- * the method invocation.
+ * If not a String literal, evaluates the expression relative to the provided context, invokes the method that was found
+ * using the supplied parameters, and returns the result of the method invocation.
*
- * Any parameters passed to this method is ignored if isLiteralText()
- * or isParmetersProvided() is true.
+ * Any parameters passed to this method is ignored if isLiteralText() or isParmetersProvided() is true.
*
* @param context The context of this evaluation.
- * @param params The parameters to pass to the method, or
- * <code>null</code> if no parameters.
- * @return the result of the method invocation (<code>null</code> if
- * the method has a <code>void</code> return type).
+ * @param params The parameters to pass to the method, or <code>null</code> if no parameters.
+ * @return the result of the method invocation (<code>null</code> if the method has a <code>void</code> return type).
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotFoundException if one of the property
- * resolutions failed because a specified variable or property
- * does not exist or is not readable.
+ * @throws PropertyNotFoundException if one of the property resolutions failed because a specified variable or property
+ * does not exist or is not readable.
* @throws MethodNotFoundException if no suitable method can be found.
- * @throws ELException if a String literal is specified and
- * expectedReturnType of the MethodExpression is void or if the coercion of the String literal
- * to the expectedReturnType yields an error (see Section "1.18 Type
- * Conversion").
- * @throws ELException if
- * an exception was thrown while performing
- * property or variable resolution. The thrown exception must be
- * included as the cause property of this exception, if
- * available. If the exception thrown is an
- * <code>InvocationTargetException</code>, extract its
- * <code>cause</code> and pass it to the
- * <code>ELException</code> constructor.
+ * @throws ELException if a String literal is specified and expectedReturnType of the MethodExpression is void or if the
+ * coercion of the String literal to the expectedReturnType yields an error (see Section "1.18 Type Conversion").
+ * @throws ELException if an exception was thrown while performing property or variable resolution. The thrown exception
+ * must be included as the cause property of this exception, if available. If the exception thrown is an
+ * <code>InvocationTargetException</code>, extract its <code>cause</code> and pass it to the <code>ELException</code>
+ * constructor.
*/
public abstract Object invoke(ELContext context, Object[] params);
/**
* Return whether this MethodExpression was created with parameters.
*
- * <p>This method must return <code>true</code> if and only if
- * parameters are specified in the EL, using the
- * expr-a.expr-b(...) syntax.</p>
+ * <p>
+ * This method must return <code>true</code> if and only if parameters are specified in the EL, using the
+ * expr-a.expr-b(...) syntax.
+ * </p>
*
- * @return <code>true</code> if the MethodExpression was created with
- * parameters, <code>false</code> otherwise.
+ * @return <code>true</code> if the MethodExpression was created with parameters, <code>false</code> otherwise.
* @since EL 2.2
*/
public boolean isParametersProvided() {
@@ -133,8 +109,8 @@
/**
* Use isParametersProvided instead.
- * @return <code>true</code> if the MethodExpression was created with
- * parameters, <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the MethodExpression was created with parameters, <code>false</code> otherwise.
*/
@Deprecated
public boolean isParmetersProvided() {
diff --git a/api/src/main/java/javax/el/MethodInfo.java b/api/src/main/java/javax/el/MethodInfo.java
index 67273ff..352b8b4 100644
--- a/api/src/main/java/javax/el/MethodInfo.java
+++ b/api/src/main/java/javax/el/MethodInfo.java
@@ -18,16 +18,14 @@
package javax.el;
/**
- * Holds information about a method that a {@link MethodExpression}
- * evaluated to.
+ * Holds information about a method that a {@link MethodExpression} evaluated to.
*
* @since JSP 2.1
*/
public class MethodInfo {
-
- /**
- * Creates a new instance of <code>MethodInfo</code> with the given
- * information.
+
+ /**
+ * Creates a new instance of <code>MethodInfo</code> with the given information.
*
* @param name The name of the method
* @param returnType The return type of the method
@@ -47,7 +45,7 @@
public String getName() {
return this.name;
}
-
+
/**
* Returns the return type of the method
*
@@ -56,7 +54,7 @@
public Class<?> getReturnType() {
return this.returnType;
}
-
+
/**
* Returns the parameter types of the method
*
@@ -65,7 +63,7 @@
public Class<?>[] getParamTypes() {
return this.paramTypes;
}
-
+
private String name;
private Class<?> returnType;
private Class<?>[] paramTypes;
diff --git a/api/src/main/java/javax/el/MethodNotFoundException.java b/api/src/main/java/javax/el/MethodNotFoundException.java
index f708088..abbce74 100644
--- a/api/src/main/java/javax/el/MethodNotFoundException.java
+++ b/api/src/main/java/javax/el/MethodNotFoundException.java
@@ -18,8 +18,7 @@
package javax.el;
/**
- * Thrown when a method could not be found while evaluating a
- * {@link MethodExpression}.
+ * Thrown when a method could not be found while evaluating a {@link MethodExpression}.
*
* @see MethodExpression
* @since JSP 2.1
@@ -30,37 +29,34 @@
* Creates a <code>MethodNotFoundException</code> with no detail message.
*/
public MethodNotFoundException() {
- super ();
+ super();
}
/**
- * Creates a <code>MethodNotFoundException</code> with the provided
- * detail message.
+ * Creates a <code>MethodNotFoundException</code> with the provided detail message.
*
* @param message the detail message
*/
public MethodNotFoundException(String message) {
- super (message);
+ super(message);
}
/**
- * Creates a <code>MethodNotFoundException</code> with the given root
- * cause.
+ * Creates a <code>MethodNotFoundException</code> with the given root cause.
*
* @param exception the originating cause of this exception
*/
public MethodNotFoundException(Throwable exception) {
- super (exception);
+ super(exception);
}
/**
- * Creates a <code>MethodNotFoundException</code> with the given detail
- * message and root cause.
+ * Creates a <code>MethodNotFoundException</code> with the given detail message and root cause.
*
* @param pMessage the detail message
* @param pRootCause the originating cause of this exception
*/
public MethodNotFoundException(String pMessage, Throwable pRootCause) {
- super (pMessage, pRootCause);
+ super(pMessage, pRootCause);
}
}
diff --git a/api/src/main/java/javax/el/PropertyNotFoundException.java b/api/src/main/java/javax/el/PropertyNotFoundException.java
index 5232feb..26a33c9 100644
--- a/api/src/main/java/javax/el/PropertyNotFoundException.java
+++ b/api/src/main/java/javax/el/PropertyNotFoundException.java
@@ -18,55 +18,52 @@
package javax.el;
/**
- * Thrown when a property could not be found while evaluating a
- * {@link ValueExpression} or {@link MethodExpression}.
+ * Thrown when a property could not be found while evaluating a {@link ValueExpression} or {@link MethodExpression}.
*
- * <p>For example, this could be triggered by an index out of bounds
- * while setting an array value, or by an unreadable property while
- * getting the value of a JavaBeans property.</p>
+ * <p>
+ * For example, this could be triggered by an index out of bounds while setting an array value, or by an unreadable
+ * property while getting the value of a JavaBeans property.
+ * </p>
*
* @since JSP 2.1
*/
public class PropertyNotFoundException extends ELException {
- //-------------------------------------
+ // -------------------------------------
/**
* Creates a <code>PropertyNotFoundException</code> with no detail message.
*/
public PropertyNotFoundException() {
- super ();
+ super();
}
- //-------------------------------------
+ // -------------------------------------
/**
- * Creates a <code>PropertyNotFoundException</code> with the provided
- * detail message.
+ * Creates a <code>PropertyNotFoundException</code> with the provided detail message.
*
* @param message the detail message
*/
public PropertyNotFoundException(String message) {
- super (message);
+ super(message);
}
/**
- * Creates a <code>PropertyNotFoundException</code> with the given root
- * cause.
+ * Creates a <code>PropertyNotFoundException</code> with the given root cause.
*
* @param exception the originating cause of this exception
*/
public PropertyNotFoundException(Throwable exception) {
- super (exception);
+ super(exception);
}
/**
- * Creates a <code>PropertyNotFoundException</code> with the given detail
- * message and root cause.
+ * Creates a <code>PropertyNotFoundException</code> with the given detail message and root cause.
*
* @param pMessage the detail message
* @param pRootCause the originating cause of this exception
*/
public PropertyNotFoundException(String pMessage, Throwable pRootCause) {
- super (pMessage, pRootCause);
+ super(pMessage, pRootCause);
}
}
diff --git a/api/src/main/java/javax/el/PropertyNotWritableException.java b/api/src/main/java/javax/el/PropertyNotWritableException.java
index 1d17cf2..468f76e 100644
--- a/api/src/main/java/javax/el/PropertyNotWritableException.java
+++ b/api/src/main/java/javax/el/PropertyNotWritableException.java
@@ -17,59 +17,54 @@
package javax.el;
-
/**
- * Thrown when a property could not be written to while setting the
- * value on a {@link ValueExpression}.
+ * Thrown when a property could not be written to while setting the value on a {@link ValueExpression}.
*
- * <p>For example, this could be triggered by trying to set a map value
- * on an unmodifiable map.</p>
+ * <p>
+ * For example, this could be triggered by trying to set a map value on an unmodifiable map.
+ * </p>
*
* @since JSP 2.1
*/
public class PropertyNotWritableException extends ELException {
- //-------------------------------------
+ // -------------------------------------
/**
- * Creates a <code>PropertyNotWritableException</code> with no detail
- * message.
+ * Creates a <code>PropertyNotWritableException</code> with no detail message.
*/
public PropertyNotWritableException() {
- super ();
+ super();
}
- //-------------------------------------
+ // -------------------------------------
/**
- * Creates a <code>PropertyNotWritableException</code> with the
- * provided detail message.
+ * Creates a <code>PropertyNotWritableException</code> with the provided detail message.
*
* @param pMessage the detail message
*/
public PropertyNotWritableException(String pMessage) {
- super (pMessage);
+ super(pMessage);
}
- //-------------------------------------
+ // -------------------------------------
/**
- * Creates a <code>PropertyNotWritableException</code> with the given root
- * cause.
+ * Creates a <code>PropertyNotWritableException</code> with the given root cause.
*
* @param exception the originating cause of this exception
*/
public PropertyNotWritableException(Throwable exception) {
- super (exception);
+ super(exception);
}
- //-------------------------------------
+ // -------------------------------------
/**
- * Creates a <code>PropertyNotWritableException</code> with the given
- * detail message and root cause.
+ * Creates a <code>PropertyNotWritableException</code> with the given detail message and root cause.
*
* @param pMessage the detail message
* @param pRootCause the originating cause of this exception
*/
public PropertyNotWritableException(String pMessage, Throwable pRootCause) {
- super (pMessage, pRootCause);
+ super(pMessage, pRootCause);
}
}
diff --git a/api/src/main/java/javax/el/ResourceBundleELResolver.java b/api/src/main/java/javax/el/ResourceBundleELResolver.java
index 01fa3d7..febc585 100644
--- a/api/src/main/java/javax/el/ResourceBundleELResolver.java
+++ b/api/src/main/java/javax/el/ResourceBundleELResolver.java
@@ -26,25 +26,21 @@
import java.util.ResourceBundle;
/**
- * Defines property resolution behavior on instances of
- * {@link java.util.ResourceBundle}.
+ * Defines property resolution behavior on instances of {@link java.util.ResourceBundle}.
*
* <p>
- * This resolver handles base objects of type
- * <code>java.util.ResourceBundle</code>. It accepts any object as a property
+ * This resolver handles base objects of type <code>java.util.ResourceBundle</code>. It accepts any object as a property
* and coerces it to a <code>java.lang.String</code> for invoking
* {@link java.util.ResourceBundle#getObject(java.lang.String)}.
* </p>
*
* <p>
- * This resolver is read only and will throw a
- * {@link PropertyNotWritableException} if <code>setValue</code> is called.
+ * This resolver is read only and will throw a {@link PropertyNotWritableException} if <code>setValue</code> is called.
* </p>
*
* <p>
- * <code>ELResolver</code>s are combined together using
- * {@link CompositeELResolver}s, to define rich semantics for evaluating an
- * expression. See the javadocs for {@link ELResolver} for details.
+ * <code>ELResolver</code>s are combined together using {@link CompositeELResolver}s, to define rich semantics for
+ * evaluating an expression. See the javadocs for {@link ELResolver} for details.
* </p>
*
* @see CompositeELResolver
@@ -55,39 +51,25 @@
public class ResourceBundleELResolver extends ELResolver {
/**
- * If the base object is an instance of <code>ResourceBundle</code>,
- * the provided property will first be coerced to a <code>String</code>.
- * The <code>Object</code> returned by <code>getObject</code> on
- * the base <code>ResourceBundle</code> will be returned.
+ * If the base object is an instance of <code>ResourceBundle</code>, the provided property will first be coerced to a
+ * <code>String</code>. The <code>Object</code> returned by <code>getObject</code> on the base
+ * <code>ResourceBundle</code> will be returned.
*
* <p>
- * If the base is <code>ResourceBundle</code>, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this method
- * is called, the caller should ignore the return value.
+ * If the base is <code>ResourceBundle</code>, the <code>propertyResolved</code> property of the <code>ELContext</code>
+ * object must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code>
+ * after this method is called, the caller should ignore the return value.
*
- * @param context
- * The context of this evaluation.
- * @param base
- * The ResourceBundle to analyze.
- * @param property
- * The name of the property to analyze. Will be coerced to a
- * <code>String</code>.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * <code>null</code> if property is <code>null</code>;
- * otherwise the <code>Object</code> for the given key
- * (property coerced to <code>String</code>) from the
- * <code>ResourceBundle</code>.
- * If no object for the given key can be found, then the
- * <code>String</code> "???" + key + "???".
- * @throws NullPointerException
- * if context is <code>null</code>
- * @throws ELException
- * if an exception was thrown while performing the property or
- * variable resolution. The thrown exception must be included as
- * the cause property of this exception, if available.
+ * @param context The context of this evaluation.
+ * @param base The ResourceBundle to analyze.
+ * @param property The name of the property to analyze. Will be coerced to a <code>String</code>.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * <code>null</code> if property is <code>null</code>; otherwise the <code>Object</code> for the given key (property
+ * coerced to <code>String</code>) from the <code>ResourceBundle</code>. If no object for the given key can be found,
+ * then the <code>String</code> "???" + key + "???".
+ * @throws NullPointerException if context is <code>null</code>
+ * @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown
+ * exception must be included as the cause property of this exception, if available.
*/
@Override
public Object getValue(ELContext context, Object base, Object property) {
@@ -99,8 +81,7 @@
context.setPropertyResolved(true);
if (property != null) {
try {
- return ((ResourceBundle) base).getObject(property
- .toString());
+ return ((ResourceBundle) base).getObject(property.toString());
} catch (MissingResourceException e) {
return "???" + property + "???";
}
@@ -110,28 +91,21 @@
}
/**
- * If the base object is an instance of <code>ResourceBundle</code>,
- * return <code>null</code>, since the resolver is read only.
+ * If the base object is an instance of <code>ResourceBundle</code>, return <code>null</code>, since the resolver is
+ * read only.
*
* <p>
- * If the base is <code>ResourceBundle</code>, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this method
- * is called, the caller should ignore the return value.
+ * If the base is <code>ResourceBundle</code>, the <code>propertyResolved</code> property of the <code>ELContext</code>
+ * object must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code>
+ * after this method is called, the caller should ignore the return value.
* </p>
*
- * @param context
- * The context of this evaluation.
- * @param base
- * The ResourceBundle to analyze.
- * @param property
- * The name of the property to analyze.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * <code>null</code>; otherwise undefined.
- * @throws NullPointerException
- * if context is <code>null</code>
+ * @param context The context of this evaluation.
+ * @param base The ResourceBundle to analyze.
+ * @param property The name of the property to analyze.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * <code>null</code>; otherwise undefined.
+ * @throws NullPointerException if context is <code>null</code>
*/
@Override
public Class<?> getType(ELContext context, Object base, Object property) {
@@ -146,53 +120,36 @@
}
/**
- * If the base object is a ResourceBundle, throw a
- * {@link PropertyNotWritableException}.
+ * If the base object is a ResourceBundle, throw a {@link PropertyNotWritableException}.
*
- * @param context
- * The context of this evaluation.
- * @param base
- * The ResourceBundle to be modified. Only bases that are of type
- * ResourceBundle are handled.
- * @param property
- * The String property to use.
- * @param value
- * The value to be set.
- * @throws NullPointerException
- * if context is <code>null</code>.
- * @throws PropertyNotWritableException
- * Always thrown if base is an instance of ReasourceBundle.
+ * @param context The context of this evaluation.
+ * @param base The ResourceBundle to be modified. Only bases that are of type ResourceBundle are handled.
+ * @param property The String property to use.
+ * @param value The value to be set.
+ * @throws NullPointerException if context is <code>null</code>.
+ * @throws PropertyNotWritableException Always thrown if base is an instance of ReasourceBundle.
*/
@Override
- public void setValue(ELContext context, Object base, Object property,
- Object value) {
+ public void setValue(ELContext context, Object base, Object property, Object value) {
if (context == null) {
throw new NullPointerException();
}
if (base instanceof ResourceBundle) {
context.setPropertyResolved(true);
- throw new PropertyNotWritableException(
- "ResourceBundles are immutable");
+ throw new PropertyNotWritableException("ResourceBundles are immutable");
}
}
/**
- * If the base object is not null and an <code>instanceof</code> {@link ResourceBundle},
- * return <code>true</code>.
+ * If the base object is not null and an <code>instanceof</code> {@link ResourceBundle}, return <code>true</code>.
*
- * @param context
- * The context of this evaluation.
- * @param base
- * The ResourceBundle to be modified. Only bases that are of type
- * ResourceBundle are handled.
- * @param property
- * The String property to use.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * <code>true</code>; otherwise undefined.
- * @throws NullPointerException
- * if context is <code>null</code>
+ * @param context The context of this evaluation.
+ * @param base The ResourceBundle to be modified. Only bases that are of type ResourceBundle are handled.
+ * @param property The String property to use.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * <code>true</code>; otherwise undefined.
+ * @throws NullPointerException if context is <code>null</code>
*/
@Override
public boolean isReadOnly(ELContext context, Object base, Object property) {
@@ -207,15 +164,12 @@
}
/**
- * If the base object is a ResourceBundle, returns an <code>Iterator</code>
- * containing the set of keys available in the <code>ResourceBundle</code>.
- * Otherwise, returns <code>null</code>.
+ * If the base object is a ResourceBundle, returns an <code>Iterator</code> containing the set of keys available in the
+ * <code>ResourceBundle</code>. Otherwise, returns <code>null</code>.
*
* <p>
- * The <code>Iterator</code> returned must contain zero or more instances
- * of {@link java.beans.FeatureDescriptor}. Each info object contains
- * information about a key in the ResourceBundle, and is initialized as
- * follows:
+ * The <code>Iterator</code> returned must contain zero or more instances of {@link java.beans.FeatureDescriptor}. Each
+ * info object contains information about a key in the ResourceBundle, and is initialized as follows:
* <ul>
* <li>displayName - The <code>String</code> key
* <li>name - Same as displayName property.</li>
@@ -225,24 +179,18 @@
* <li>preferred - <code>true</code></li>
* </ul>
*
- * In addition, the following named attributes must be set in the returned
- * <code>FeatureDescriptor</code>s:
+ * In addition, the following named attributes must be set in the returned <code>FeatureDescriptor</code>s:
* <ul>
* <li>{@link ELResolver#TYPE} - <code>String.class</code></li>
* <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - <code>true</code></li>
* </ul>
*
*
- * @param context
- * The context of this evaluation.
- * @param base
- * The bundle whose keys are to be iterated over. Only bases of
- * type <code>ResourceBundle</code> are handled by this
- * resolver.
- * @return An <code>Iterator</code> containing zero or more (possibly
- * infinitely more) <code>FeatureDescriptor</code> objects, each
- * representing a key in this bundle, or <code>null</code> if the
- * base object is not a ResourceBundle.
+ * @param context The context of this evaluation.
+ * @param base The bundle whose keys are to be iterated over. Only bases of type <code>ResourceBundle</code> are handled
+ * by this resolver.
+ * @return An <code>Iterator</code> containing zero or more (possibly infinitely more) <code>FeatureDescriptor</code>
+ * objects, each representing a key in this bundle, or <code>null</code> if the base object is not a ResourceBundle.
*/
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
@@ -269,21 +217,15 @@
}
/**
- * If the base object is a ResourceBundle, returns the most general type
- * that this resolver accepts for the <code>property</code> argument.
- * Otherwise, returns <code>null</code>.
+ * If the base object is a ResourceBundle, returns the most general type that this resolver accepts for the
+ * <code>property</code> argument. Otherwise, returns <code>null</code>.
*
* <p>
- * Assuming the base is a <code>ResourceBundle</code>, this method will
- * always return <code>String.class</code>.
+ * Assuming the base is a <code>ResourceBundle</code>, this method will always return <code>String.class</code>.
*
- * @param context
- * The context of this evaluation.
- * @param base
- * The bundle to analyze. Only bases of type
- * <code>ResourceBundle</code> are handled by this resolver.
- * @return <code>null</code> if base is not a <code>ResourceBundle</code>;
- * otherwise <code>String.class</code>.
+ * @param context The context of this evaluation.
+ * @param base The bundle to analyze. Only bases of type <code>ResourceBundle</code> are handled by this resolver.
+ * @return <code>null</code> if base is not a <code>ResourceBundle</code>; otherwise <code>String.class</code>.
*/
@Override
public Class<?> getCommonPropertyType(ELContext context, Object base) {
diff --git a/api/src/main/java/javax/el/StandardELContext.java b/api/src/main/java/javax/el/StandardELContext.java
index b88d99d..7721e3f 100644
--- a/api/src/main/java/javax/el/StandardELContext.java
+++ b/api/src/main/java/javax/el/StandardELContext.java
@@ -21,10 +21,9 @@
import java.util.Map;
/**
- * A standard ELContext suitable for use in a stand alone environment.
- * This class provides a default implementation of an ELResolver that contains
- * a number of useful ELResolvers. It also provides local repositories for
- * the FunctionMapper, VariableMapper, and BeanNameResolver.
+ * A standard ELContext suitable for use in a stand alone environment. This class provides a default implementation of
+ * an ELResolver that contains a number of useful ELResolvers. It also provides local repositories for the
+ * FunctionMapper, VariableMapper, and BeanNameResolver.
*
* @since EL 3.0
*/
@@ -37,8 +36,8 @@
private ELResolver elResolver;
/*
- * The list of the custom ELResolvers added to the ELResolvers.
- * An ELResolver is added to the list when addELResolver is called.
+ * The list of the custom ELResolvers added to the ELResolvers. An ELResolver is added to the list when addELResolver is
+ * called.
*/
private CompositeELResolver customResolvers;
@@ -63,9 +62,8 @@
private VariableMapper variableMapper;
/*
- * If non-null, indicates the presence of a delegate ELContext.
- * When a Standard is constructed from another ELContext, there is no
- * easy way to get its private context map, therefore delegation is needed.
+ * If non-null, indicates the presence of a delegate ELContext. When a Standard is constructed from another ELContext,
+ * there is no easy way to get its private context map, therefore delegation is needed.
*/
private ELContext delegate = null;
@@ -76,6 +74,7 @@
/**
* Construct a default ELContext for a stand-alone environment.
+ *
* @param factory The ExpressionFactory
*/
public StandardELContext(ExpressionFactory factory) {
@@ -85,6 +84,7 @@
/**
* Construct a StandardELContext from another ELContext.
+ *
* @param context The ELContext that acts as a delegate in most cases
*/
public StandardELContext(ELContext context) {
@@ -104,7 +104,7 @@
@Override
public void putContext(Class key, Object contextObject) {
- if (delegate !=null) {
+ if (delegate != null) {
delegate.putContext(key, contextObject);
} else {
super.putContext(key, contextObject);
@@ -113,7 +113,7 @@
@Override
public Object getContext(Class key) {
- if (delegate !=null) {
+ if (delegate != null) {
return delegate.getContext(key);
} else {
return super.getContext(key);
@@ -124,9 +124,8 @@
* Construct (if needed) and return a default ELResolver.
*
* <p>
- * Retrieves the <code>ELResolver</code> associated with this context.
- * This is a <code>CompositeELResover</code> consists of an ordered list of
- * <code>ELResolver</code>s.
+ * Retrieves the <code>ELResolver</code> associated with this context. This is a <code>CompositeELResover</code>
+ * consists of an ordered list of <code>ELResolver</code>s.
*
* <ol>
* <li>A {@link BeanNameELResolver} for beans defined locally</li>
@@ -164,18 +163,19 @@
}
/**
- * Add a custom ELResolver to the context. The list of the custom
- * ELResolvers will be accessed in the order they are added.
- * A custom ELResolver added to the context cannot be removed.
+ * Add a custom ELResolver to the context. The list of the custom ELResolvers will be accessed in the order they are
+ * added. A custom ELResolver added to the context cannot be removed.
+ *
* @param cELResolver The new ELResolver to be added to the context
*/
public void addELResolver(ELResolver cELResolver) {
- getELResolver(); // make sure elResolver is constructed
+ getELResolver(); // make sure elResolver is constructed
customResolvers.add(cELResolver);
}
/**
* Get the local bean repository
+ *
* @return the bean repository
*/
Map<String, Object> getBeans() {
@@ -184,6 +184,7 @@
/**
* Construct (if needed) and return a default FunctionMapper.
+ *
* @return The default FunctionMapper
*/
@Override
@@ -196,6 +197,7 @@
/**
* Construct (if needed) and return a default VariableMapper() {
+ *
* @return The default Variable
*/
@Override
@@ -210,10 +212,8 @@
private Map<String, Method> functions = null;
- DefaultFunctionMapper(Map<String, Method> initMap){
- functions = (initMap == null)?
- new HashMap<String, Method>():
- new HashMap<String, Method>(initMap);
+ DefaultFunctionMapper(Map<String, Method> initMap) {
+ functions = (initMap == null) ? new HashMap<String, Method>() : new HashMap<String, Method>(initMap);
}
@Override
@@ -221,9 +221,8 @@
return functions.get(prefix + ":" + localName);
}
-
@Override
- public void mapFunction(String prefix, String localName, Method meth){
+ public void mapFunction(String prefix, String localName, Method meth) {
functions.put(prefix + ":" + localName, meth);
}
}
@@ -233,7 +232,7 @@
private Map<String, ValueExpression> variables = null;
@Override
- public ValueExpression resolveVariable (String variable) {
+ public ValueExpression resolveVariable(String variable) {
if (variables == null) {
return null;
}
@@ -241,8 +240,7 @@
}
@Override
- public ValueExpression setVariable(String variable,
- ValueExpression expression) {
+ public ValueExpression setVariable(String variable, ValueExpression expression) {
if (variables == null) {
variables = new HashMap<String, ValueExpression>();
}
@@ -284,4 +282,3 @@
}
}
}
-
diff --git a/api/src/main/java/javax/el/StaticFieldELResolver.java b/api/src/main/java/javax/el/StaticFieldELResolver.java
index 4726d90..f50c60c 100644
--- a/api/src/main/java/javax/el/StaticFieldELResolver.java
+++ b/api/src/main/java/javax/el/StaticFieldELResolver.java
@@ -24,10 +24,13 @@
import java.util.Iterator;
/**
- * <p>An {@link ELResolver} for resolving static fields, enum constants and
- * static methods. Also handles constructor calls as a special case.</p>
- * <p>The resolver handles base objects of the type {@link ELClass}, which
- * is usually generated by an EL implementation.</p>
+ * <p>
+ * An {@link ELResolver} for resolving static fields, enum constants and static methods. Also handles constructor calls
+ * as a special case.
+ * </p>
+ * <p>
+ * The resolver handles base objects of the type {@link ELClass}, which is usually generated by an EL implementation.
+ * </p>
*
* @see ELClass
* @since EL 3.0
@@ -35,28 +38,27 @@
public class StaticFieldELResolver extends ELResolver {
/**
- * <p>Returns the value of a static field.</p>
- * <p>If the base object is an instance of <code>ELClass</code> and the
- * property is String, the
- * <code>propertyResolved</code> property of the <code>ELContext</code>
- * object must be set to <code>true</code> by this resolver, before
- * returning. If this property is not <code>true</code> after this
- * method is called, the caller should ignore the return value.</p>
+ * <p>
+ * Returns the value of a static field.
+ * </p>
+ * <p>
+ * If the base object is an instance of <code>ELClass</code> and the property is String, the
+ * <code>propertyResolved</code> property of the <code>ELContext</code> object must be set to <code>true</code> by this
+ * resolver, before returning. If this property is not <code>true</code> after this method is called, the caller should
+ * ignore the return value.
+ * </p>
*
- * If the property is a public static field of class specified in
- * <code>ELClass</code>, return the value of the static field.
- * An Enum constant is a
- * public static field of an Enum object, and is a special case of this.
+ * If the property is a public static field of class specified in <code>ELClass</code>, return the value of the static
+ * field. An Enum constant is a public static field of an Enum object, and is a special case of this.
+ *
* @param context The context of this evaluation.
* @param base An <code>ELClass</code>.
* @param property A static field name.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the static field value.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the static field value.
* @throws NullPointerException if context is <code>null</code>.
- * @throws PropertyNotFoundException if the specified class does not exist,
- * or if the field is not a public static filed of the class,
- * or if the field is inaccessible.
+ * @throws PropertyNotFoundException if the specified class does not exist, or if the field is not a public static filed
+ * of the class, or if the field is inaccessible.
*/
@Override
public Object getValue(ELContext context, Object base, Object property) {
@@ -66,7 +68,7 @@
}
if (base instanceof ELClass && property instanceof String) {
- Class<?> klass = ((ELClass)base).getKlass();
+ Class<?> klass = ((ELClass) base).getKlass();
String fieldName = (String) property;
try {
context.setPropertyResolved(base, property);
@@ -78,41 +80,37 @@
} catch (NoSuchFieldException ex) {
} catch (IllegalAccessException ex) {
}
- throw new PropertyNotFoundException(
- ELUtil.getExceptionMessageString(context,
- "staticFieldReadError",
- new Object[] { klass.getName(), fieldName}));
+ throw new PropertyNotFoundException(ELUtil.getExceptionMessageString(context, "staticFieldReadError", new Object[] { klass.getName(), fieldName }));
}
return null;
}
/**
- * <p> Attempts to write to a static field.</p>
- * <p>If the base object is an instance of <code>ELClass</code>and the
- * property is String, a <code>PropertyNotWritableException</code>
- * will always be thrown, because writing to a static field is not
- * allowed.
+ * <p>
+ * Attempts to write to a static field.
+ * </p>
+ * <p>
+ * If the base object is an instance of <code>ELClass</code>and the property is String, a
+ * <code>PropertyNotWritableException</code> will always be thrown, because writing to a static field is not allowed.
+ *
* @param context The context of this evaluation.
* @param base An <code>ELClass</code>
* @param property The name of the field
* @param value The value to set the field of the class to.
* @throws NullPointerException if context is <code>null</code>
- * @throws PropertyNotWritableException if base object instance of <code>ELClass</code>and
- * <code>property</code> instance of String
+ * @throws PropertyNotWritableException if base object instance of <code>ELClass</code>and <code>property</code>
+ * instance of String
*/
@Override
- public void setValue(ELContext context, Object base, Object property,
- Object value) {
+ public void setValue(ELContext context, Object base, Object property, Object value) {
if (context == null) {
throw new NullPointerException();
}
- if (base instanceof ELClass && property instanceof String) {
- Class<?> klass = ((ELClass)base).getKlass();
+ if (base instanceof ELClass && property instanceof String) {
+ Class<?> klass = ((ELClass) base).getKlass();
String fieldName = (String) property;
throw new PropertyNotWritableException(
- ELUtil.getExceptionMessageString(context,
- "staticFieldWriteError",
- new Object[] { klass.getName(), fieldName}));
+ ELUtil.getExceptionMessageString(context, "staticFieldWriteError", new Object[] { klass.getName(), fieldName }));
}
}
@@ -120,52 +118,35 @@
* Invokes a public static method or the constructor for a class.
*
* <p>
- * If the base object is an instance of <code>ELClass</code> and the
- * method is a String,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller
- * should ignore the return value.
+ * If the base object is an instance of <code>ELClass</code> and the method is a String, the
+ * <code>propertyResolved</code> property of the <code>ELContext</code> object must be set to <code>true</code> by the
+ * resolver, before returning. If this property is not <code>true</code> after this method is called, the caller should
+ * ignore the return value.
*
* <p>
* Invoke the public static method specified by <code>method</code>.
*
* <p>
- * The process involved in the method selection is
- * the same as that used in {@link BeanELResolver}.
+ * The process involved in the method selection is the same as that used in {@link BeanELResolver}.
*
* <p>
- * As a special case, if the name of the method is "<init>", the
- * constructor for the class will be invoked.
+ * As a special case, if the name of the method is "<init>", the constructor for the class will be invoked.
*
* @param base An <code>ELClass</code>
- * @param method When coerced to a <code>String</code>,
- * the simple name of the method.
- * @param paramTypes An array of Class objects identifying the
- * method's formal parameter types, in declared order.
- * Use an empty array if the method has no parameters.
- * Can be <code>null</code>, in which case the method's formal
- * parameter types are assumed to be unknown.
- * @param params The parameters to pass to the method, or
- * <code>null</code> if no parameters.
- * @return The result of the method invocation (<code>null</code> if
- * the method has a <code>void</code> return type).
+ * @param method When coerced to a <code>String</code>, the simple name of the method.
+ * @param paramTypes An array of Class objects identifying the method's formal parameter types, in declared order. Use
+ * an empty array if the method has no parameters. Can be <code>null</code>, in which case the method's formal parameter
+ * types are assumed to be unknown.
+ * @param params The parameters to pass to the method, or <code>null</code> if no parameters.
+ * @return The result of the method invocation (<code>null</code> if the method has a <code>void</code> return type).
* @throws MethodNotFoundException if no suitable method can be found.
- * @throws ELException if an exception was thrown while performing
- * (base, method) resolution. The thrown exception must be
- * included as the cause property of this exception, if
- * available. If the exception thrown is an
- * <code>InvocationTargetException</code>, extract its
- * <code>cause</code> and pass it to the
- * <code>ELException</code> constructor.
+ * @throws ELException if an exception was thrown while performing (base, method) resolution. The thrown exception must
+ * be included as the cause property of this exception, if available. If the exception thrown is an
+ * <code>InvocationTargetException</code>, extract its <code>cause</code> and pass it to the <code>ELException</code>
+ * constructor.
*/
@Override
- public Object invoke(ELContext context,
- Object base,
- Object method,
- Class<?>[] paramTypes,
- Object[] params) {
+ public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) {
if (context == null) {
throw new NullPointerException();
@@ -175,17 +156,15 @@
return null;
}
- Class<?> klass = ((ELClass)base).getKlass();
+ Class<?> klass = ((ELClass) base).getKlass();
String name = (String) method;
Object ret;
if ("<init>".equals(name)) {
- Constructor<?> constructor =
- ELUtil.findConstructor(klass, paramTypes, params);
+ Constructor<?> constructor = ELUtil.findConstructor(klass, paramTypes, params);
ret = ELUtil.invokeConstructor(context, constructor, params);
} else {
- Method meth =
- ELUtil.findMethod(klass, name, paramTypes, params, true);
+ Method meth = ELUtil.findMethod(klass, name, paramTypes, params, true);
ret = ELUtil.invokeMethod(context, meth, null, params);
}
context.setPropertyResolved(base, method);
@@ -196,27 +175,22 @@
* Returns the type of a static field.
*
* <p>
- * If the base object is an instance of <code>ELClass</code>and the
- * property is a String,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller can
+ * If the base object is an instance of <code>ELClass</code>and the property is a String, the
+ * <code>propertyResolved</code> property of the <code>ELContext</code> object must be set to <code>true</code> by the
+ * resolver, before returning. If this property is not <code>true</code> after this method is called, the caller can
* safely assume no value has been set.
*
* <p>
- * If the property string is a public static field of class specified in
- * ELClass, return the type of the static field.
+ * If the property string is a public static field of class specified in ELClass, return the type of the static field.
*
* @param context The context of this evaluation.
* @param base An <code>ELClass</code>.
* @param property The name of the field.
- * @return If the <code>propertyResolved</code> property of
- * <code>ELContext</code> was set to <code>true</code>, then
- * the type of the type of the field.
+ * @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then
+ * the type of the type of the field.
* @throws NullPointerException if context is <code>null</code>.
- * @throws PropertyNotFoundException if field is not a public static
- * filed of the class, or if the field is inaccessible.
+ * @throws PropertyNotFoundException if field is not a public static filed of the class, or if the field is
+ * inaccessible.
*/
@Override
public Class<?> getType(ELContext context, Object base, Object property) {
@@ -225,8 +199,8 @@
throw new NullPointerException();
}
- if (base instanceof ELClass && property instanceof String) {
- Class<?> klass = ((ELClass)base).getKlass();
+ if (base instanceof ELClass && property instanceof String) {
+ Class<?> klass = ((ELClass) base).getKlass();
String fieldName = (String) property;
try {
context.setPropertyResolved(true);
@@ -237,26 +211,26 @@
}
} catch (NoSuchFieldException ex) {
}
- throw new PropertyNotFoundException(
- ELUtil.getExceptionMessageString(context,
- "staticFieldReadError",
- new Object[] { klass.getName(), fieldName}));
+ throw new PropertyNotFoundException(ELUtil.getExceptionMessageString(context, "staticFieldReadError", new Object[] { klass.getName(), fieldName }));
}
return null;
}
/**
- * <p>Inquires whether the static field is writable.</p>
- * <p>If the base object is an instance of <code>ELClass</code>and the
- * property is a String,
- * the <code>propertyResolved</code> property of the
- * <code>ELContext</code> object must be set to <code>true</code>
- * by the resolver, before returning. If this property is not
- * <code>true</code> after this method is called, the caller can
- * safely assume no value has been set.</p>
+ * <p>
+ * Inquires whether the static field is writable.
+ * </p>
+ * <p>
+ * If the base object is an instance of <code>ELClass</code>and the property is a String, the
+ * <code>propertyResolved</code> property of the <code>ELContext</code> object must be set to <code>true</code> by the
+ * resolver, before returning. If this property is not <code>true</code> after this method is called, the caller can
+ * safely assume no value has been set.
+ * </p>
*
- * <p>Always returns a <code>true</code> because writing to a static field
- * is not allowed.</p>
+ * <p>
+ * Always returns a <code>true</code> because writing to a static field is not allowed.
+ * </p>
+ *
* @param context The context of this evaluation.
* @param base An <code>ELClass</code>.
* @param property The name of the bean.
@@ -269,30 +243,29 @@
throw new NullPointerException();
}
- if (base instanceof ELClass && property instanceof String) {
- Class<?> klass = ((ELClass)base).getKlass();
+ if (base instanceof ELClass && property instanceof String) {
+ Class<?> klass = ((ELClass) base).getKlass();
context.setPropertyResolved(true);
}
return true;
}
/**
- * Returns the properties that can be resolved.
- * Always returns <code>null</code>, since there is no reason to
- * iterate through a list of one element: field name.
+ * Returns the properties that can be resolved. Always returns <code>null</code>, since there is no reason to iterate
+ * through a list of one element: field name.
+ *
* @param context The context of this evaluation.
* @param base An <code>ELClass</code>.
* @return <code>null</code>.
*/
@Override
- public Iterator<FeatureDescriptor> getFeatureDescriptors(
- ELContext context, Object base) {
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return null;
}
/**
- * Returns the type of the property.
- * Always returns <code>String.class</code>, since a field name is a String.
+ * Returns the type of the property. Always returns <code>String.class</code>, since a field name is a String.
+ *
* @param context The context of this evaluation.
* @param base An <code>ELClass</code>.
* @return <code>String.class</code>.
diff --git a/api/src/main/java/javax/el/TypeConverter.java b/api/src/main/java/javax/el/TypeConverter.java
index 02e13a5..e582b39 100644
--- a/api/src/main/java/javax/el/TypeConverter.java
+++ b/api/src/main/java/javax/el/TypeConverter.java
@@ -22,7 +22,8 @@
/**
* A convenient class for writing an ELResolver to do custom type conversions.
*
- * <p>For example, to convert a String to an instance of MyDate, one can write
+ * <p>
+ * For example, to convert a String to an instance of MyDate, one can write
*
* <pre>
* <code>
@@ -45,51 +46,40 @@
public abstract class TypeConverter extends ELResolver {
@Override
- public Object getValue(ELContext context,
- Object base,
- Object property) {
+ public Object getValue(ELContext context, Object base, Object property) {
return null;
}
@Override
- public Class<?> getType(ELContext context,
- Object base,
- Object property) {
+ public Class<?> getType(ELContext context, Object base, Object property) {
return null;
}
@Override
- public void setValue(ELContext context,
- Object base,
- Object property,
- Object value) {
+ public void setValue(ELContext context, Object base, Object property, Object value) {
}
@Override
- public boolean isReadOnly(ELContext context,
- Object base,
- Object property){
+ public boolean isReadOnly(ELContext context, Object base, Object property) {
return false;
}
@Override
- public Iterator<FeatureDescriptor> getFeatureDescriptors(
- ELContext context,
- Object base) {
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return null;
}
@Override
- public Class<?> getCommonPropertyType(ELContext context,
- Object base) {
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
return null;
}
/**
* Converts an object to a specific type.
*
- * <p>An <code>ELException</code> is thrown if an error occurs during
- * the conversion.</p>
+ * <p>
+ * An <code>ELException</code> is thrown if an error occurs during the conversion.
+ * </p>
*
* @param context The context of this evaluation.
* @param obj The object to convert.
@@ -97,7 +87,5 @@
* @throws ELException thrown if errors occur.
*/
@Override
- abstract public Object convertToType(ELContext context,
- Object obj,
- Class<?> targetType);
+ abstract public Object convertToType(ELContext context, Object obj, Class<?> targetType);
}
diff --git a/api/src/main/java/javax/el/ValueExpression.java b/api/src/main/java/javax/el/ValueExpression.java
index 433c210..09f88af 100644
--- a/api/src/main/java/javax/el/ValueExpression.java
+++ b/api/src/main/java/javax/el/ValueExpression.java
@@ -20,162 +20,129 @@
/**
* An <code>Expression</code> that can get or set a value.
*
- * <p>In previous incarnations of this API, expressions could only be
- * read. <code>ValueExpression</code> objects can now be used both to
- * retrieve a value and to set a value. Expressions that can have a value
- * set on them are referred to as l-value expressions. Those that
- * cannot are referred to as r-value expressions. Not all r-value expressions
- * can be used as l-value expressions (e.g. <code>"${1+1}"</code> or
- * <code>"${firstName} ${lastName}"</code>). See the EL Specification for
- * details. Expressions that cannot be used as l-values must always
- * return <code>true</code> from <code>isReadOnly()</code>.</p>
- *
- * <p>The <code>{@link ExpressionFactory#createValueExpression}</code> method
- * can be used to parse an expression string and return a concrete instance
- * of <code>ValueExpression</code> that encapsulates the parsed expression.
- * The {@link FunctionMapper} is used at parse time, not evaluation time,
- * so one is not needed to evaluate an expression using this class.
- * However, the {@link ELContext} is needed at evaluation time.</p>
- *
- * <p>The {@link #getValue}, {@link #setValue}, {@link #isReadOnly},
- * {@link #getType} and {@link #getValueReference}
- * methods will evaluate the expression each time they are
- * called. The {@link ELResolver} in the <code>ELContext</code> is used to
- * resolve the top-level variables and to determine the behavior of the
- * <code>.</code> and <code>[]</code> operators. For any of the five methods,
- * the {@link ELResolver#getValue} method is used to resolve all properties
- * up to but excluding the last one. This provides the <code>base</code>
- * object. For all methods other than the {@link #getValueReference} method,
- * at the last resolution, the <code>ValueExpression</code> will
- * call the corresponding {@link ELResolver#getValue},
- * {@link ELResolver#setValue}, {@link ELResolver#isReadOnly} or
- * {@link ELResolver#getType} method, depending on which was called on
- * the <code>ValueExpression</code>.
- * For the {@link #getValueReference} method, the (base, property) is
- * not resolved by the ELResolver, but an instance of {@link ValueReference}
- * is created to encapsulate this (base ,property), and returned.
+ * <p>
+ * In previous incarnations of this API, expressions could only be read. <code>ValueExpression</code> objects can now be
+ * used both to retrieve a value and to set a value. Expressions that can have a value set on them are referred to as
+ * l-value expressions. Those that cannot are referred to as r-value expressions. Not all r-value expressions can be
+ * used as l-value expressions (e.g. <code>"${1+1}"</code> or <code>"${firstName} ${lastName}"</code>). See the EL
+ * Specification for details. Expressions that cannot be used as l-values must always return <code>true</code> from
+ * <code>isReadOnly()</code>.
* </p>
*
- * <p>See the notes about comparison, serialization and immutability in
- * the {@link Expression} javadocs.
+ * <p>
+ * The <code>{@link ExpressionFactory#createValueExpression}</code> method can be used to parse an expression string and
+ * return a concrete instance of <code>ValueExpression</code> that encapsulates the parsed expression. The
+ * {@link FunctionMapper} is used at parse time, not evaluation time, so one is not needed to evaluate an expression
+ * using this class. However, the {@link ELContext} is needed at evaluation time.
+ * </p>
+ *
+ * <p>
+ * The {@link #getValue}, {@link #setValue}, {@link #isReadOnly}, {@link #getType} and {@link #getValueReference}
+ * methods will evaluate the expression each time they are called. The {@link ELResolver} in the <code>ELContext</code>
+ * is used to resolve the top-level variables and to determine the behavior of the <code>.</code> and <code>[]</code>
+ * operators. For any of the five methods, the {@link ELResolver#getValue} method is used to resolve all properties up
+ * to but excluding the last one. This provides the <code>base</code> object. For all methods other than the
+ * {@link #getValueReference} method, at the last resolution, the <code>ValueExpression</code> will call the
+ * corresponding {@link ELResolver#getValue}, {@link ELResolver#setValue}, {@link ELResolver#isReadOnly} or
+ * {@link ELResolver#getType} method, depending on which was called on the <code>ValueExpression</code>. For the
+ * {@link #getValueReference} method, the (base, property) is not resolved by the ELResolver, but an instance of
+ * {@link ValueReference} is created to encapsulate this (base ,property), and returned.
+ * </p>
+ *
+ * <p>
+ * See the notes about comparison, serialization and immutability in the {@link Expression} javadocs.
*
* @see ELResolver
* @see Expression
* @see ExpressionFactory
* @since JSP 2.1
*/
-public abstract class ValueExpression
- extends Expression
-{
-
+public abstract class ValueExpression extends Expression {
+
/**
- * Evaluates the expression relative to the provided context, and
- * returns the resulting value.
+ * Evaluates the expression relative to the provided context, and returns the resulting value.
*
- * <p>The resulting value is automatically coerced to the type
- * returned by <code>getExpectedType()</code>, which was
- * provided to the <code>ExpressionFactory</code> when this
- * expression was created.</p>
+ * <p>
+ * The resulting value is automatically coerced to the type returned by <code>getExpectedType()</code>, which was
+ * provided to the <code>ExpressionFactory</code> when this expression was created.
+ * </p>
*
* @param context The context of this evaluation.
* @return The result of the expression evaluation.
* @throws NullPointerException if context is <code>null</code>.
- * @throws PropertyNotFoundException if one of the property
- * resolutions failed because a specified variable or property
- * does not exist or is not readable.
- * @throws ELException if an exception was thrown while performing
- * property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if one of the property resolutions failed because a specified variable or property
+ * does not exist or is not readable.
+ * @throws ELException if an exception was thrown while performing property or variable resolution. The thrown exception
+ * must be included as the cause property of this exception, if available.
*/
public abstract Object getValue(ELContext context);
-
+
/**
- * Evaluates the expression relative to the provided context, and
- * sets the result to the provided value.
+ * Evaluates the expression relative to the provided context, and sets the result to the provided value.
*
* @param context The context of this evaluation.
* @param value The new value to be set.
* @throws NullPointerException if context is <code>null</code>.
- * @throws PropertyNotFoundException if one of the property
- * resolutions failed because a specified variable or property
- * does not exist or is not readable.
- * @throws PropertyNotWritableException if the final variable or
- * property resolution failed because the specified
- * variable or property is not writable.
- * @throws ELException if an exception was thrown while attempting to
- * set the property or variable. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if one of the property resolutions failed because a specified variable or property
+ * does not exist or is not readable.
+ * @throws PropertyNotWritableException if the final variable or property resolution failed because the specified
+ * variable or property is not writable.
+ * @throws ELException if an exception was thrown while attempting to set the property or variable. The thrown exception
+ * must be included as the cause property of this exception, if available.
*/
public abstract void setValue(ELContext context, Object value);
-
+
/**
- * Evaluates the expression relative to the provided context, and
- * returns <code>true</code> if a call to {@link #setValue} will
- * always fail.
+ * Evaluates the expression relative to the provided context, and returns <code>true</code> if a call to
+ * {@link #setValue} will always fail.
*
* @param context The context of this evaluation.
- * @return <code>true</code> if the expression is read-only or
- * <code>false</code> if not.
+ * @return <code>true</code> if the expression is read-only or <code>false</code> if not.
* @throws NullPointerException if context is <code>null</code>.
- * @throws PropertyNotFoundException if one of the property
- * resolutions failed because a specified variable or property
- * does not exist or is not readable.
- * @throws ELException if an exception was thrown while performing
- * property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
- * * @throws NullPointerException if context is <code>null</code>
+ * @throws PropertyNotFoundException if one of the property resolutions failed because a specified variable or property
+ * does not exist or is not readable.
+ * @throws ELException if an exception was thrown while performing property or variable resolution. The thrown exception
+ * must be included as the cause property of this exception, if available. * @throws NullPointerException if context is
+ * <code>null</code>
*/
public abstract boolean isReadOnly(ELContext context);
-
+
/**
- * Evaluates the expression relative to the provided context, and
- * returns the most general type that is acceptable for an object to be
- * passed as the <code>value</code> parameter in a future call
- * to the {@link #setValue} method.
+ * Evaluates the expression relative to the provided context, and returns the most general type that is acceptable for
+ * an object to be passed as the <code>value</code> parameter in a future call to the {@link #setValue} method.
*
- * <p>This is not always the same as <code>getValue().getClass()</code>.
- * For example, in the case of an expression that references an
- * array element, the <code>getType</code> method will return the
- * element type of the array, which might be a superclass of the type
- * of the actual element that is currently in the specified
- * array element.</p>
+ * <p>
+ * This is not always the same as <code>getValue().getClass()</code>. For example, in the case of an expression that
+ * references an array element, the <code>getType</code> method will return the element type of the array, which might
+ * be a superclass of the type of the actual element that is currently in the specified array element.
+ * </p>
*
* @param context The context of this evaluation.
* @return the most general acceptable type; otherwise undefined.
* @throws NullPointerException if context is <code>null</code>.
- * @throws PropertyNotFoundException if one of the property
- * resolutions failed because a specified variable or property
- * does not exist or is not readable.
- * @throws ELException if an exception was thrown while performing
- * property or variable resolution. The thrown exception
- * must be included as the cause property of this exception, if
- * available.
+ * @throws PropertyNotFoundException if one of the property resolutions failed because a specified variable or property
+ * does not exist or is not readable.
+ * @throws ELException if an exception was thrown while performing property or variable resolution. The thrown exception
+ * must be included as the cause property of this exception, if available.
*/
public abstract Class<?> getType(ELContext context);
-
+
/**
- * Returns the type the result of the expression will be coerced to
- * after evaluation.
+ * Returns the type the result of the expression will be coerced to after evaluation.
*
- * @return the <code>expectedType</code> passed to the
- * <code>ExpressionFactory.createValueExpression</code> method
- * that created this <code>ValueExpression</code>.
+ * @return the <code>expectedType</code> passed to the <code>ExpressionFactory.createValueExpression</code> method that
+ * created this <code>ValueExpression</code>.
*/
public abstract Class<?> getExpectedType();
/**
* Returns a {@link ValueReference} for this expression instance.
+ *
* @param context the context of this evaluation
- * @return the <code>ValueReference</code> for this
- * <code>ValueExpression</code>, or <code>null</code> if this
- * <code>ValueExpression</code> is not a reference to
- * a base (null or non-null) and a property.
- * If the base is null, and the property is a EL variable, return
- * the <code>ValueReference</code> for the
- * <code>ValueExpression</code> associated with this EL variable.
+ * @return the <code>ValueReference</code> for this <code>ValueExpression</code>, or <code>null</code> if this
+ * <code>ValueExpression</code> is not a reference to a base (null or non-null) and a property. If the base is null, and
+ * the property is a EL variable, return the <code>ValueReference</code> for the <code>ValueExpression</code> associated
+ * with this EL variable.
*
* @since EL 2.2
*/
diff --git a/api/src/main/java/javax/el/VariableMapper.java b/api/src/main/java/javax/el/VariableMapper.java
index 0aae995..95ba21a 100644
--- a/api/src/main/java/javax/el/VariableMapper.java
+++ b/api/src/main/java/javax/el/VariableMapper.java
@@ -18,35 +18,27 @@
package javax.el;
/**
- * The interface to a map between EL variables and the EL expressions
- * they are associated with.
+ * The interface to a map between EL variables and the EL expressions they are associated with.
*
* @since JSP 2.1
*/
public abstract class VariableMapper {
-
+
/**
* @param variable The variable name
- * @return the ValueExpression assigned to the variable,
- * null if there is no previous assignment to this variable.
+ * @return the ValueExpression assigned to the variable, null if there is no previous assignment to this variable.
*/
- public abstract ValueExpression resolveVariable(
- String variable);
-
+ public abstract ValueExpression resolveVariable(String variable);
+
/**
- * Assign a ValueExpression to an EL variable, replacing
- * any previously assignment to the same variable.
- * The assignment for the variable is removed if
- * the expression is <code>null</code>.
+ * Assign a ValueExpression to an EL variable, replacing any previously assignment to the same variable. The assignment
+ * for the variable is removed if the expression is <code>null</code>.
*
* @param variable The variable name
- * @param expression The ValueExpression to be assigned
- * to the variable.
- * @return The previous ValueExpression assigned to this variable,
- * null if there is no previous assignment to this variable.
+ * @param expression The ValueExpression to be assigned to the variable.
+ * @return The previous ValueExpression assigned to this variable, null if there is no previous assignment to this
+ * variable.
*/
- public abstract ValueExpression setVariable(
- String variable,
- ValueExpression expression);
+ public abstract ValueExpression setVariable(String variable, ValueExpression expression);
}
diff --git a/impl/src/main/java/com/sun/el/ExpressionFactoryImpl.java b/impl/src/main/java/com/sun/el/ExpressionFactoryImpl.java
index 24d1dc6..2f751c5 100644
--- a/impl/src/main/java/com/sun/el/ExpressionFactoryImpl.java
+++ b/impl/src/main/java/com/sun/el/ExpressionFactoryImpl.java
@@ -65,40 +65,33 @@
return ret;
}
- public MethodExpression createMethodExpression(ELContext context,
- String expression, Class expectedReturnType,
- Class[] expectedParamTypes) {
+ public MethodExpression createMethodExpression(ELContext context, String expression, Class expectedReturnType, Class[] expectedParamTypes) {
ExpressionBuilder builder = new ExpressionBuilder(expression, context);
- MethodExpression me = builder.createMethodExpression(expectedReturnType,
- expectedParamTypes);
+ MethodExpression me = builder.createMethodExpression(expectedReturnType, expectedParamTypes);
if (expectedParamTypes == null && !me.isParametersProvided()) {
- throw new NullPointerException(MessageFactory
- .get("error.method.nullParms"));
+ throw new NullPointerException(MessageFactory.get("error.method.nullParms"));
}
return me;
}
- public ValueExpression createValueExpression(ELContext context,
- String expression, Class expectedType) {
+ public ValueExpression createValueExpression(ELContext context, String expression, Class expectedType) {
if (expectedType == null) {
- throw new NullPointerException(MessageFactory
- .get("error.value.expectedType"));
+ throw new NullPointerException(MessageFactory.get("error.value.expectedType"));
}
ExpressionBuilder builder = new ExpressionBuilder(expression, context);
return builder.createValueExpression(expectedType);
}
- public ValueExpression createValueExpression(Object instance,
- Class expectedType) {
+ public ValueExpression createValueExpression(Object instance, Class expectedType) {
if (expectedType == null) {
- throw new NullPointerException(MessageFactory
- .get("error.value.expectedType"));
+ throw new NullPointerException(MessageFactory.get("error.value.expectedType"));
}
return new ValueExpressionLiteral(instance, expectedType);
}
public String getProperty(String key) {
- if (properties == null) return null;
+ if (properties == null)
+ return null;
return properties.getProperty(key);
}
diff --git a/impl/src/main/java/com/sun/el/MethodExpressionImpl.java b/impl/src/main/java/com/sun/el/MethodExpressionImpl.java
index 106e79c..e4bb00c 100644
--- a/impl/src/main/java/com/sun/el/MethodExpressionImpl.java
+++ b/impl/src/main/java/com/sun/el/MethodExpressionImpl.java
@@ -42,30 +42,26 @@
* An <code>Expression</code> that refers to a method on an object.
*
* <p>
- * The {@link ExpressionFactory#createMethodExpression} method
- * can be used to parse an expression string and return a concrete instance
- * of <code>MethodExpression</code> that encapsulates the parsed expression.
- * The {@link FunctionMapper} is used at parse time, not evaluation time,
- * so one is not needed to evaluate an expression using this class.
- * However, the {@link ELContext} is needed at evaluation time.</p>
+ * The {@link ExpressionFactory#createMethodExpression} method can be used to parse an expression string and return a
+ * concrete instance of <code>MethodExpression</code> that encapsulates the parsed expression. The
+ * {@link FunctionMapper} is used at parse time, not evaluation time, so one is not needed to evaluate an expression
+ * using this class. However, the {@link ELContext} is needed at evaluation time.
+ * </p>
*
- * <p>The {@link #getMethodInfo} and {@link #invoke} methods will evaluate the
- * expression each time they are called. The {@link ELResolver} in the
- * <code>ELContext</code> is used to resolve the top-level variables and to
- * determine the behavior of the <code>.</code> and <code>[]</code>
- * operators. For any of the two methods, the {@link ELResolver#getValue}
- * method is used to resolve all properties up to but excluding the last
- * one. This provides the <code>base</code> object on which the method
- * appears. If the <code>base</code> object is null, a
- * <code>NullPointerException</code> must be thrown. At the last resolution,
- * the final <code>property</code> is then coerced to a <code>String</code>,
- * which provides the name of the method to be found. A method matching the
- * name and expected parameters provided at parse time is found and it is
- * either queried or invoked (depending on the method called on this
- * <code>MethodExpression</code>).</p>
+ * <p>
+ * The {@link #getMethodInfo} and {@link #invoke} methods will evaluate the expression each time they are called. The
+ * {@link ELResolver} in the <code>ELContext</code> is used to resolve the top-level variables and to determine the
+ * behavior of the <code>.</code> and <code>[]</code> operators. For any of the two methods, the
+ * {@link ELResolver#getValue} method is used to resolve all properties up to but excluding the last one. This provides
+ * the <code>base</code> object on which the method appears. If the <code>base</code> object is null, a
+ * <code>NullPointerException</code> must be thrown. At the last resolution, the final <code>property</code> is then
+ * coerced to a <code>String</code>, which provides the name of the method to be found. A method matching the name and
+ * expected parameters provided at parse time is found and it is either queried or invoked (depending on the method
+ * called on this <code>MethodExpression</code>).
+ * </p>
*
- * <p>See the notes about comparison, serialization and immutability in
- * the {@link Expression} javadocs.
+ * <p>
+ * See the notes about comparison, serialization and immutability in the {@link Expression} javadocs.
*
* @see javax.el.ELResolver
* @see javax.el.Expression
@@ -75,8 +71,7 @@
* @author Jacob Hookom [jacob@hookom.net]
* @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $
*/
-public final class MethodExpressionImpl extends MethodExpression implements
- Externalizable {
+public final class MethodExpressionImpl extends MethodExpression implements Externalizable {
private Class expectedType;
@@ -105,9 +100,7 @@
* @param expectedType expected return type of method
* @param paramTypes the method parameters
*/
- public MethodExpressionImpl(String expr, Node node,
- FunctionMapper fnMapper, VariableMapper varMapper,
- Class expectedType, Class[] paramTypes) {
+ public MethodExpressionImpl(String expr, Node node, FunctionMapper fnMapper, VariableMapper varMapper, Class expectedType, Class[] paramTypes) {
super();
this.expr = expr;
this.node = node;
@@ -118,29 +111,22 @@
}
/**
- * Determines whether the specified object is equal to this
- * <code>Expression</code>.
+ * Determines whether the specified object is equal to this <code>Expression</code>.
*
* <p>
- * The result is <code>true</code> if and only if the argument is not
- * <code>null</code>, is an <code>Expression</code> object that is the
- * of the same type (<code>ValueExpression</code> or
- * <code>MethodExpression</code>), and has an identical parsed
- * representation.
+ * The result is <code>true</code> if and only if the argument is not <code>null</code>, is an <code>Expression</code>
+ * object that is the of the same type (<code>ValueExpression</code> or <code>MethodExpression</code>), and has an
+ * identical parsed representation.
* </p>
*
* <p>
- * Note that two expressions can be equal if their expression Strings are
- * different. For example, <code>${fn1:foo()}</code> and
- * <code>${fn2:foo()}</code> are equal if their corresponding
- * <code>FunctionMapper</code>s mapped <code>fn1:foo</code> and
- * <code>fn2:foo</code> to the same method.
+ * Note that two expressions can be equal if their expression Strings are different. For example,
+ * <code>${fn1:foo()}</code> and <code>${fn2:foo()}</code> are equal if their corresponding <code>FunctionMapper</code>s
+ * mapped <code>fn1:foo</code> and <code>fn2:foo</code> to the same method.
* </p>
*
- * @param obj
- * the <code>Object</code> to test for equality.
- * @return <code>true</code> if <code>obj</code> equals this
- * <code>Expression</code>; <code>false</code> otherwise.
+ * @param obj the <code>Object</code> to test for equality.
+ * @return <code>true</code> if <code>obj</code> equals this <code>Expression</code>; <code>false</code> otherwise.
* @see java.util.Hashtable
* @see java.lang.Object#equals(java.lang.Object)
*/
@@ -154,20 +140,17 @@
}
/**
- * Returns the original String used to create this <code>Expression</code>,
- * unmodified.
+ * Returns the original String used to create this <code>Expression</code>, unmodified.
*
* <p>
- * This is used for debugging purposes but also for the purposes of
- * comparison (e.g. to ensure the expression in a configuration file has not
- * changed).
+ * This is used for debugging purposes but also for the purposes of comparison (e.g. to ensure the expression in a
+ * configuration file has not changed).
* </p>
*
* <p>
- * This method does not provide sufficient information to re-create an
- * expression. Two different expressions can have exactly the same
- * expression string but different function mappings. Serialization should
- * be used to save and restore the state of an <code>Expression</code>.
+ * This method does not provide sufficient information to re-create an expression. Two different expressions can have
+ * exactly the same expression string but different function mappings. Serialization should be used to save and restore
+ * the state of an <code>Expression</code>.
* </p>
*
* @return The original expression String.
@@ -180,34 +163,24 @@
}
/**
- * Evaluates the expression relative to the provided context, and returns
- * information about the actual referenced method.
+ * Evaluates the expression relative to the provided context, and returns information about the actual referenced
+ * method.
*
- * @param context
- * The context of this evaluation
- * @return an instance of <code>MethodInfo</code> containing information
- * about the method the expression evaluated to.
- * @throws NullPointerException
- * if context is <code>null</code> or the base object is
- * <code>null</code> on the last resolution.
- * @throws PropertyNotFoundException
- * if one of the property resolutions failed because a specified
- * variable or property does not exist or is not readable.
- * @throws MethodNotFoundException
- * if no suitable method can be found.
- * @throws ELException
- * if an exception was thrown while performing property or
- * variable resolution. The thrown exception must be included as
- * the cause property of this exception, if available.
+ * @param context The context of this evaluation
+ * @return an instance of <code>MethodInfo</code> containing information about the method the expression evaluated to.
+ * @throws NullPointerException if context is <code>null</code> or the base object is <code>null</code> on the last
+ * resolution.
+ * @throws PropertyNotFoundException if one of the property resolutions failed because a specified variable or property
+ * does not exist or is not readable.
+ * @throws MethodNotFoundException if no suitable method can be found.
+ * @throws ELException if an exception was thrown while performing property or variable resolution. The thrown exception
+ * must be included as the cause property of this exception, if available.
* @see javax.el.MethodExpression#getMethodInfo(javax.el.ELContext)
*/
@Override
- public MethodInfo getMethodInfo(ELContext context)
- throws PropertyNotFoundException, MethodNotFoundException,
- ELException {
+ public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundException, MethodNotFoundException, ELException {
Node n = this.getNode();
- EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
- this.varMapper);
+ EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper);
return n.getMethodInfo(ctx, this.paramTypes);
}
@@ -226,12 +199,10 @@
* Returns the hash code for this <code>Expression</code>.
*
* <p>
- * See the note in the {@link #equals} method on how two expressions can be
- * equal if their expression Strings are different. Recall that if two
- * objects are equal according to the <code>equals(Object)</code> method,
- * then calling the <code>hashCode</code> method on each of the two
- * objects must produce the same integer result. Implementations must take
- * special note and implement <code>hashCode</code> correctly.
+ * See the note in the {@link #equals} method on how two expressions can be equal if their expression Strings are
+ * different. Recall that if two objects are equal according to the <code>equals(Object)</code> method, then calling the
+ * <code>hashCode</code> method on each of the two objects must produce the same integer result. Implementations must
+ * take special note and implement <code>hashCode</code> correctly.
* </p>
*
* @return The hash code for this <code>Expression</code>.
@@ -245,41 +216,26 @@
}
/**
- * Evaluates the expression relative to the provided context, invokes the
- * method that was found using the supplied parameters, and returns the
- * result of the method invocation.
+ * Evaluates the expression relative to the provided context, invokes the method that was found using the supplied
+ * parameters, and returns the result of the method invocation.
*
- * @param context
- * The context of this evaluation.
- * @param params
- * The parameters to pass to the method, or <code>null</code>
- * if no parameters.
- * @return the result of the method invocation (<code>null</code> if the
- * method has a <code>void</code> return type).
- * @throws NullPointerException
- * if context is <code>null</code> or the base object is
- * <code>null</code> on the last resolution.
- * @throws PropertyNotFoundException
- * if one of the property resolutions failed because a specified
- * variable or property does not exist or is not readable.
- * @throws MethodNotFoundException
- * if no suitable method can be found.
- * @throws ELException
- * if an exception was thrown while performing property or
- * variable resolution. The thrown exception must be included as
- * the cause property of this exception, if available. If the
- * exception thrown is an <code>InvocationTargetException</code>,
- * extract its <code>cause</code> and pass it to the
- * <code>ELException</code> constructor.
- * @see javax.el.MethodExpression#invoke(javax.el.ELContext,
- * java.lang.Object[])
+ * @param context The context of this evaluation.
+ * @param params The parameters to pass to the method, or <code>null</code> if no parameters.
+ * @return the result of the method invocation (<code>null</code> if the method has a <code>void</code> return type).
+ * @throws NullPointerException if context is <code>null</code> or the base object is <code>null</code> on the last
+ * resolution.
+ * @throws PropertyNotFoundException if one of the property resolutions failed because a specified variable or property
+ * does not exist or is not readable.
+ * @throws MethodNotFoundException if no suitable method can be found.
+ * @throws ELException if an exception was thrown while performing property or variable resolution. The thrown exception
+ * must be included as the cause property of this exception, if available. If the exception thrown is an
+ * <code>InvocationTargetException</code>, extract its <code>cause</code> and pass it to the <code>ELException</code>
+ * constructor.
+ * @see javax.el.MethodExpression#invoke(javax.el.ELContext, java.lang.Object[])
*/
@Override
- public Object invoke(ELContext context, Object[] params)
- throws PropertyNotFoundException, MethodNotFoundException,
- ELException {
- EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
- this.varMapper);
+ public Object invoke(ELContext context, Object[] params) throws PropertyNotFoundException, MethodNotFoundException, ELException {
+ EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper);
ctx.notifyBeforeEvaluation(this.expr);
Object obj = this.getNode().invoke(ctx, this.paramTypes, params);
ctx.notifyAfterEvaluation(this.expr);
@@ -292,15 +248,13 @@
* @see java.io.Externalizable#readExternal(java.io.ObjectInput)
*/
@Override
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException {
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
this.expr = in.readUTF();
String type = in.readUTF();
if (!"".equals(type)) {
this.expectedType = ReflectionUtil.forName(type);
}
- this.paramTypes = ReflectionUtil.toTypeArray(((String[]) in
- .readObject()));
+ this.paramTypes = ReflectionUtil.toTypeArray(((String[]) in.readObject()));
this.fnMapper = (FunctionMapper) in.readObject();
this.varMapper = (VariableMapper) in.readObject();
}
@@ -313,8 +267,7 @@
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(this.expr);
- out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
- : "");
+ out.writeUTF((this.expectedType != null) ? this.expectedType.getName() : "");
out.writeObject(ReflectionUtil.toTypeNameArray(this.paramTypes));
out.writeObject(this.fnMapper);
out.writeObject(this.varMapper);
@@ -330,4 +283,3 @@
return this.getNode().isParametersProvided();
}
}
-
diff --git a/impl/src/main/java/com/sun/el/MethodExpressionLiteral.java b/impl/src/main/java/com/sun/el/MethodExpressionLiteral.java
index 507076f..0bf86f4 100644
--- a/impl/src/main/java/com/sun/el/MethodExpressionLiteral.java
+++ b/impl/src/main/java/com/sun/el/MethodExpressionLiteral.java
@@ -34,13 +34,13 @@
private Class expectedType;
private String expr;
-
+
private Class[] paramTypes;
-
+
public MethodExpressionLiteral() {
// do nothing
}
-
+
public MethodExpressionLiteral(String expr, Class expectedType, Class[] paramTypes) {
this.expr = expr;
this.expectedType = expectedType;
@@ -59,7 +59,7 @@
try {
return context.convertToType(this.expr, this.expectedType);
} catch (Exception ex) {
- throw new ELException (ex);
+ throw new ELException(ex);
}
}
@@ -85,14 +85,12 @@
if (!"".equals(type)) {
this.expectedType = ReflectionUtil.forName(type);
}
- this.paramTypes = ReflectionUtil.toTypeArray(((String[]) in
- .readObject()));
+ this.paramTypes = ReflectionUtil.toTypeArray(((String[]) in.readObject()));
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(this.expr);
- out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
- : "");
+ out.writeUTF((this.expectedType != null) ? this.expectedType.getName() : "");
out.writeObject(ReflectionUtil.toTypeNameArray(this.paramTypes));
}
}
diff --git a/impl/src/main/java/com/sun/el/ValueExpressionImpl.java b/impl/src/main/java/com/sun/el/ValueExpressionImpl.java
index 515acd7..9e287cd 100644
--- a/impl/src/main/java/com/sun/el/ValueExpressionImpl.java
+++ b/impl/src/main/java/com/sun/el/ValueExpressionImpl.java
@@ -43,41 +43,33 @@
* An <code>Expression</code> that can get or set a value.
*
* <p>
- * In previous incarnations of this API, expressions could only be read.
- * <code>ValueExpression</code> objects can now be used both to retrieve a
- * value and to set a value. Expressions that can have a value set on them are
- * referred to as l-value expressions. Those that cannot are referred to as
- * r-value expressions. Not all r-value expressions can be used as l-value
- * expressions (e.g. <code>"${1+1}"</code> or
- * <code>"${firstName} ${lastName}"</code>). See the EL Specification for
- * details. Expressions that cannot be used as l-values must always return
- * <code>true</code> from <code>isReadOnly()</code>.
+ * In previous incarnations of this API, expressions could only be read. <code>ValueExpression</code> objects can now be
+ * used both to retrieve a value and to set a value. Expressions that can have a value set on them are referred to as
+ * l-value expressions. Those that cannot are referred to as r-value expressions. Not all r-value expressions can be
+ * used as l-value expressions (e.g. <code>"${1+1}"</code> or <code>"${firstName} ${lastName}"</code>). See the EL
+ * Specification for details. Expressions that cannot be used as l-values must always return <code>true</code> from
+ * <code>isReadOnly()</code>.
* </p>
*
* <p>
- * The {@link ExpressionFactory#createValueExpression} method
- * can be used to parse an expression string and return a concrete instance
- * of <code>ValueExpression</code> that encapsulates the parsed expression.
- * The {@link FunctionMapper} is used at parse time, not evaluation time,
- * so one is not needed to evaluate an expression using this class.
- * However, the {@link ELContext} is needed at evaluation time.</p>
- *
- * <p>The {@link #getValue}, {@link #setValue}, {@link #isReadOnly} and
- * {@link #getType} methods will evaluate the expression each time they are
- * called. The {@link ELResolver} in the <code>ELContext</code> is used to
- * resolve the top-level variables and to determine the behavior of the
- * <code>.</code> and <code>[]</code> operators. For any of the four methods,
- * the {@link ELResolver#getValue} method is used to resolve all properties
- * up to but excluding the last one. This provides the <code>base</code>
- * object. At the last resolution, the <code>ValueExpression</code> will
- * call the corresponding {@link ELResolver#getValue},
- * {@link ELResolver#setValue}, {@link ELResolver#isReadOnly} or
- * {@link ELResolver#getType} method, depending on which was called on
- * the <code>ValueExpression</code>.
+ * The {@link ExpressionFactory#createValueExpression} method can be used to parse an expression string and return a
+ * concrete instance of <code>ValueExpression</code> that encapsulates the parsed expression. The {@link FunctionMapper}
+ * is used at parse time, not evaluation time, so one is not needed to evaluate an expression using this class. However,
+ * the {@link ELContext} is needed at evaluation time.
* </p>
*
- * <p>See the notes about comparison, serialization and immutability in
- * the {@link Expression} javadocs.
+ * <p>
+ * The {@link #getValue}, {@link #setValue}, {@link #isReadOnly} and {@link #getType} methods will evaluate the
+ * expression each time they are called. The {@link ELResolver} in the <code>ELContext</code> is used to resolve the
+ * top-level variables and to determine the behavior of the <code>.</code> and <code>[]</code> operators. For any of the
+ * four methods, the {@link ELResolver#getValue} method is used to resolve all properties up to but excluding the last
+ * one. This provides the <code>base</code> object. At the last resolution, the <code>ValueExpression</code> will call
+ * the corresponding {@link ELResolver#getValue}, {@link ELResolver#setValue}, {@link ELResolver#isReadOnly} or
+ * {@link ELResolver#getType} method, depending on which was called on the <code>ValueExpression</code>.
+ * </p>
+ *
+ * <p>
+ * See the notes about comparison, serialization and immutability in the {@link Expression} javadocs.
*
* @see javax.el.ELResolver
* @see javax.el.Expression
@@ -87,8 +79,7 @@
* @author Jacob Hookom [jacob@hookom.net]
* @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dochez $
*/
-public final class ValueExpressionImpl extends ValueExpression implements
- Externalizable {
+public final class ValueExpressionImpl extends ValueExpression implements Externalizable {
private Class expectedType;
@@ -104,8 +95,7 @@
}
- public ValueExpressionImpl(String expr, Node node, FunctionMapper fnMapper,
- VariableMapper varMapper, Class expectedType) {
+ public ValueExpressionImpl(String expr, Node node, FunctionMapper fnMapper, VariableMapper varMapper, Class expectedType) {
this.expr = expr;
this.node = node;
this.fnMapper = fnMapper;
@@ -138,12 +128,10 @@
}
/**
- * Returns the type the result of the expression will be coerced to after
- * evaluation.
+ * Returns the type the result of the expression will be coerced to after evaluation.
*
- * @return the <code>expectedType</code> passed to the
- * <code>ExpressionFactory.createValueExpression</code> method
- * that created this <code>ValueExpression</code>.
+ * @return the <code>expectedType</code> passed to the <code>ExpressionFactory.createValueExpression</code> method that
+ * created this <code>ValueExpression</code>.
*
* @see javax.el.Expression#getExpressionString()
*/
@@ -169,10 +157,8 @@
* @see javax.el.ValueExpression#getType(javax.el.ELContext)
*/
@Override
- public Class getType(ELContext context) throws PropertyNotFoundException,
- ELException {
- EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
- this.varMapper);
+ public Class getType(ELContext context) throws PropertyNotFoundException, ELException {
+ EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper);
return this.getNode().getType(ctx);
}
@@ -182,10 +168,8 @@
* @see javax.el.ValueExpression#getValueReference(javax.el.ELContext)
*/
@Override
- public ValueReference getValueReference(ELContext context)
- throws PropertyNotFoundException, ELException {
- EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
- this.varMapper);
+ public ValueReference getValueReference(ELContext context) throws PropertyNotFoundException, ELException {
+ EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper);
return this.getNode().getValueReference(ctx);
}
@@ -195,10 +179,8 @@
* @see javax.el.ValueExpression#getValue(javax.el.ELContext)
*/
@Override
- public Object getValue(ELContext context) throws PropertyNotFoundException,
- ELException {
- EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
- this.varMapper);
+ public Object getValue(ELContext context) throws PropertyNotFoundException, ELException {
+ EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper);
ctx.notifyBeforeEvaluation(this.expr);
Object value = this.getNode().getValue(ctx);
if (this.expectedType != null) {
@@ -242,16 +224,13 @@
* @see javax.el.ValueExpression#isReadOnly(javax.el.ELContext)
*/
@Override
- public boolean isReadOnly(ELContext context)
- throws PropertyNotFoundException, ELException {
- EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
- this.varMapper);
+ public boolean isReadOnly(ELContext context) throws PropertyNotFoundException, ELException {
+ EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper);
return this.getNode().isReadOnly(ctx);
}
@Override
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException {
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
this.expr = in.readUTF();
String type = in.readUTF();
if (!"".equals(type)) {
@@ -264,29 +243,24 @@
/*
* (non-Javadoc)
*
- * @see javax.el.ValueExpression#setValue(javax.el.ELContext,
- * java.lang.Object)
+ * @see javax.el.ValueExpression#setValue(javax.el.ELContext, java.lang.Object)
*/
@Override
- public void setValue(ELContext context, Object value)
- throws PropertyNotFoundException, PropertyNotWritableException,
- ELException {
- EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
- this.varMapper);
+ public void setValue(ELContext context, Object value) throws PropertyNotFoundException, PropertyNotWritableException, ELException {
+ EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper);
this.getNode().setValue(ctx, value);
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(this.expr);
- out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
- : "");
+ out.writeUTF((this.expectedType != null) ? this.expectedType.getName() : "");
out.writeObject(this.fnMapper);
out.writeObject(this.varMapper);
}
@Override
public String toString() {
- return "ValueExpression["+this.expr+"]";
+ return "ValueExpression[" + this.expr + "]";
}
}
diff --git a/impl/src/main/java/com/sun/el/ValueExpressionLiteral.java b/impl/src/main/java/com/sun/el/ValueExpressionLiteral.java
index 82ed197..ffcff13 100644
--- a/impl/src/main/java/com/sun/el/ValueExpressionLiteral.java
+++ b/impl/src/main/java/com/sun/el/ValueExpressionLiteral.java
@@ -31,8 +31,7 @@
import com.sun.el.util.MessageFactory;
import com.sun.el.util.ReflectionUtil;
-public final class ValueExpressionLiteral extends ValueExpression implements
- Externalizable {
+public final class ValueExpressionLiteral extends ValueExpression implements Externalizable {
private static final long serialVersionUID = 1L;
@@ -43,7 +42,7 @@
public ValueExpressionLiteral() {
super();
}
-
+
public ValueExpressionLiteral(Object value, Class expectedType) {
this.value = value;
this.expectedType = expectedType;
@@ -61,8 +60,7 @@
}
public void setValue(ELContext context, Object value) {
- throw new PropertyNotWritableException(MessageFactory.get(
- "error.value.literal.write", this.value));
+ throw new PropertyNotWritableException(MessageFactory.get("error.value.literal.write", this.value));
}
public boolean isReadOnly(ELContext context) {
@@ -82,13 +80,11 @@
}
public boolean equals(Object obj) {
- return (obj instanceof ValueExpressionLiteral && this
- .equals((ValueExpressionLiteral) obj));
+ return (obj instanceof ValueExpressionLiteral && this.equals((ValueExpressionLiteral) obj));
}
public boolean equals(ValueExpressionLiteral ve) {
- return (ve != null && (this.value != null && ve.value != null && (this.value == ve.value || this.value
- .equals(ve.value))));
+ return (ve != null && (this.value != null && ve.value != null && (this.value == ve.value || this.value.equals(ve.value))));
}
public int hashCode() {
@@ -101,12 +97,10 @@
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(this.value);
- out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
- : "");
+ out.writeUTF((this.expectedType != null) ? this.expectedType.getName() : "");
}
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException {
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
this.value = in.readObject();
String type = in.readUTF();
if (!"".equals(type)) {