org.apache.commons.jexl3.internal.introspection

## Class MapSetExecutor

- java.lang.Object
- - org.apache.commons.jexl3.internal.introspection.AbstractExecutor.Set
  - - org.apache.commons.jexl3.internal.introspection.MapSetExecutor

- All Implemented Interfaces:
    JexlPropertySet

      public final class MapSetExecutor
      extends AbstractExecutor.Set

  Specialized executor to set a property in a Map.
  Since:
    2.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AbstractExecutor.Get` Abstract class that is used to execute an arbitrary 'get' method.
    `static class` | `AbstractExecutor.Method` Abstract class that is used to execute an arbitrary method.
    `static class` | `AbstractExecutor.Set` Abstract class that is used to execute an arbitrary 'set' method.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Method` | `method` Method to be executed.
    `protected Class<?>` | `objectClass` The class this executor applies to.
    `static Object` | `TRY_FAILED` A marker for invocation failures in tryInvoke.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MapSetExecutor` | `discover(Introspector is, Class<?> clazz, Object identifier, Object value)` Attempts to discover a MapSetExecutor.
    `boolean` | `equals(org.apache.commons.jexl3.internal.introspection.AbstractExecutor arg)` Indicates whether some other executor is equivalent to this one.
    `boolean` | `equals(Object obj)`
    `Method` | `getMethod()` Gets the method to be executed or used as a marker.
    `String` | `getMethodName()` Gets the method name used.
    `Class<?>` | `getTargetClass()` Gets the object class targeted by this executor.
    `Object` | `getTargetProperty()` Gets the property targeted by this executor.
    `int` | `hashCode()`
    `Object` | `invoke(Object obj, Object value)` Method used to set the property value of an object.
    `boolean` | `isAlive()` Tell whether the executor is alive by looking at the value of the method.
    `boolean` | `isCacheable()` Specifies if this executor is cacheable and able to be reused for this class of object it was returned for.
    `boolean` | `tryFailed(Object exec)` Checks whether a tryExecute failed or not.
    `Object` | `tryInvoke(Object obj, Object key, Object value)` Attempts to reuse this JexlPropertySet, checking that it is compatible with the actual set of arguments.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.commons.jexl3.introspection.JexlPropertySet

      `isCacheable, tryFailed`

- - ### Field Detail

    - #### TRY_FAILED

          public static final Object TRY_FAILED

      A marker for invocation failures in tryInvoke.

    - #### objectClass

          protected final Class<?> objectClass

      The class this executor applies to.

    - #### method

          protected final Method method

      Method to be executed.

  - ### Method Detail

    - #### discover

          public static MapSetExecutor discover(Introspector is,
                                Class<?> clazz,
                                Object identifier,
                                Object value)

      Attempts to discover a MapSetExecutor.
      Parameters:
        `is` - the introspector
        `clazz` - the class to find the set method from
        `identifier` - the key to use as an argument to the get method
        `value` - the value to use as argument in map.put(key,value)
      Returns:
        the executor if found, null otherwise

    - #### getTargetProperty

          public Object getTargetProperty()

      Gets the property targeted by this executor.
      Returns:
        the target property

    - #### invoke

          public Object invoke(Object obj,
                      Object value)
                        throws IllegalAccessException,
                               InvocationTargetException

      Description copied from interface: `JexlPropertySet`
      Method used to set the property value of an object.
      Parameters:
        `obj` - Object on which the property setter will be called with the value
        `value` - value to be set
      Returns:
        the value returned from the set operation (impl specific)
      Throws:
        `IllegalAccessException`
        `InvocationTargetException`

    - #### tryInvoke

          public Object tryInvoke(Object obj,
                         Object key,
                         Object value)

      Description copied from interface: `JexlPropertySet`
      Attempts to reuse this JexlPropertySet, checking that it is compatible with the actual set of arguments.
      Parameters:
        `obj` - the object to invoke the the get upon
        `key` - the property key to get
        `value` - the property value to set
      Returns:
        the result of the method invocation that should be checked by tryFailed to determine if it succeeded or failed.

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(org.apache.commons.jexl3.internal.introspection.AbstractExecutor arg)

      Indicates whether some other executor is equivalent to this one.
      Parameters:
        `arg` - the other executor to check
      Returns:
        true if both executors are equivalent, false otherwise

    - #### isAlive

          public final boolean isAlive()

      Tell whether the executor is alive by looking at the value of the method.
      Returns:
        boolean Whether the executor is alive.

    - #### isCacheable

          public boolean isCacheable()

      Specifies if this executor is cacheable and able to be reused for this class of object it was returned for.
      Returns:
        true if can be reused for this class, false if not

    - #### getMethod

          public final Method getMethod()

      Gets the method to be executed or used as a marker.
      Returns:
        Method The method used by execute in derived classes.

    - #### getTargetClass

          public final Class<?> getTargetClass()

      Gets the object class targeted by this executor.
      Returns:
        the target object class

    - #### getMethodName

          public final String getMethodName()

      Gets the method name used.
      Returns:
        method name

    - #### tryFailed

          public final boolean tryFailed(Object exec)

      Checks whether a tryExecute failed or not.
      Parameters:
        `exec` - the value returned by tryExecute
      Returns:
        true if tryExecute failed, false otherwise

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.