Class DynaActionFormELResolver

java.lang.Object
jakarta.el.ELResolver
org.apache.struts.faces.application.DynaActionFormELResolver

public class DynaActionFormELResolver extends ELResolver
Defines property resolution behavior on instances of DynaActionForm.

This resolver handles base objects of type DynaActionForm with requested property name {code map}.

This resolver is in read-only mode, which means that isReadOnly(jakarta.el.ELContext, java.lang.Object, java.lang.Object) will always return true and setValue(jakarta.el.ELContext, java.lang.Object, java.lang.Object, java.lang.Object) will always throw PropertyNotWritableException.

ELResolvers are combined together using CompositeELResolvers, to define rich semantics for evaluating an expression. See the JavaDocs for ELResolver for details.

Since:
Struts 1.4.1
See Also:
  • Constructor Details

    • DynaActionFormELResolver

      public DynaActionFormELResolver()
      Creates a new read DynaActionFormELResolver.
  • Method Details

    • getType

      public Class<?> getType(ELContext context, Object base, Object property)
      If the base object is a DynaActionForm and the requested property name is {code map} then the type Map.class will be returned.

      If the base is a DynaActionForm and the requested property name is {code map}, the propertyResolved property of the ELContext object must be set to true by this resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value.

      Assuming the base is a DynaActionForm and the requested property name is {code map}, this method will always return Map.class. This is because a DynaActionForm with the property 'map' accepts only the object Map as the value for this given key.

      Specified by:
      getType in class ELResolver
      Parameters:
      context - The context of this evaluation.
      base - The base to analyze. Only bases of type DynaActionForm are handled by this resolver.
      property - The key to return the acceptable type for. Only keys with value map are handled by this resolver.
      Returns:
      If the propertyResolved property of ELContext was set to true, then the most general acceptable type; otherwise undefined.
      Throws:
      NullPointerException - if context is null
      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.
    • getValue

      public Object getValue(ELContext context, Object base, Object property)
      If the base object is a DynaActionForm and the requested property name is map, returns the map of the DynaActionForm. Otherwise null is returned.

      If the base is a DynaActionForm and the requested property name is map, the propertyResolved property of the ELContext object must be set to true by this resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value.

      Just as in DynaActionForm.getMap(), just because null is returned doesn't mean there is no mapping for the key; it's also possible that the method explicitly returns null.

      Specified by:
      getValue in class ELResolver
      Parameters:
      context - The context of this evaluation.
      base - The base to be analyzed. Only bases of type DynaActionForm are handled by this resolver.
      property - The key whose associated value is to be returned. Only keys with value map are handled by this resolver.
      Returns:
      If the propertyResolved property of ELContext was set to true, then the value associated with the given key.
      Throws:
      NullPointerException - if context is null.
      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.
    • setValue

      public void setValue(ELContext context, Object base, Object property, Object value)
      If the base is a DynaActionForm and the requested property name is map, this method always throw PropertyNotWritableException, because the map property is a ready-only property of the DynaActionForm class.
      Specified by:
      setValue in class ELResolver
      Parameters:
      context - The context of this evaluation.
      base - The base to be modified. Only bases of type DynaActionForm are handled by this resolver.
      property - The key with which the specified value is to be associated. Only keys with value map are handled by this resolver.
      value - The value to be associated with the specified key.
      Throws:
      NullPointerException - if context is null.
      PropertyNotWritableException - is always throw, because the map property is a ready-only property of the DynaActionForm class.
      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.
    • isReadOnly

      public boolean isReadOnly(ELContext context, Object base, Object property)
      If the base is a DynaActionForm and the requested property name is map, returns whether a call to setValue(jakarta.el.ELContext, java.lang.Object, java.lang.Object, java.lang.Object) will always fail. This method always returns true, because the map property is a ready-only property of the DynaActionForm class.

      If the base is a DynaActionForm and the requested property name is map, the propertyResolved property of the ELContext object must be set to true by this resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value.

      Specified by:
      isReadOnly in class ELResolver
      Parameters:
      context - The context of this evaluation.
      base - The base to analyze. Only bases of type DynaActionForm are handled by this resolver.
      property - The key to return the read-only status for. Only keys with value map are handled by this resolver.
      Returns:
      If the propertyResolved property of ELContext was set to true, then true if calling the setValue method will always fail or false if it is possible that such a call may succeed; otherwise undefined.
      Throws:
      NullPointerException - if context is null
      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.
    • getFeatureDescriptors

      public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base)
      If the base object is a DynaActionForm, returns an Iterator containing the set of keys available in the DynaActionForm. Otherwise, returns null.

      The Iterator returned must contain zero or more instances of FeatureDescriptor. Each info object contains information about a key in the Map, and is initialized as follows:

      • displayName - The return value of calling the toString method on this key, or null if the key is null.
      • name - Same as displayName property.
      • shortDescription - JavaDoc-Code of DynaActionForm.getMap()
      • expert - false
      • hidden - false
      • preferred - true
      In addition, the following named attributes must be set in the returned FeatureDescriptors:
      Specified by:
      getFeatureDescriptors in class ELResolver
      Parameters:
      context - The context of this evaluation.
      base - The object whose keys are to be iterated over. Only bases of type DynaActionForm are handled by this resolver.
      Returns:
      An Iterator containing zero or more (possibly infinitely more) FeatureDescriptor objects, each representing a key in this DynaActionForm, or null if the base object is not a DynaActionForm.
    • getCommonPropertyType

      public Class<?> getCommonPropertyType(ELContext context, Object base)
      If the base object is a DynaActionForm, returns the most general type that this resolver accepts for the property argument. Otherwise, returns null.

      Assuming the base is a DynaActionForm, this method will always return Object.class. This is because any object is accepted as a key and is coerced into a string.

      Specified by:
      getCommonPropertyType in class ELResolver
      Parameters:
      context - The context of this evaluation.
      base - The base to analyze. Only bases of type DynaActionForm are handled by this resolver.
      Returns:
      null if base is not a DynaActionForm; otherwise Object.class.