org.apache.commons.jexl3.internal.introspection
Class BooleanGetExecutor

java.lang.Object
  extended by org.apache.commons.jexl3.internal.introspection.AbstractExecutor.Get
      extended by org.apache.commons.jexl3.internal.introspection.BooleanGetExecutor
All Implemented Interfaces:
JexlPropertyGet

public final class BooleanGetExecutor
extends AbstractExecutor.Get

Specialized executor to get a boolean property from an object.

Since:
2.0

Nested Class Summary
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
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
static BooleanGetExecutor discover(Introspector is, Class<?> clazz, String property)
          Discovers a BooleanGetExecutor.
 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)
          Method used to get 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)
          Attempts to reuse this JexlPropertyGet, 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.JexlPropertyGet
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 BooleanGetExecutor discover(Introspector is,
                                          Class<?> clazz,
                                          String property)
Discovers a BooleanGetExecutor.

The method to be found should be named "is{P,p}property and return a boolean.

Parameters:
is - the introspector
clazz - the class to find the get method from
property - the the property name
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)
              throws IllegalAccessException,
                     InvocationTargetException
Description copied from interface: JexlPropertyGet
Method used to get the property value of an object.

Parameters:
obj - the object to get the property value from.
Returns:
the property value.
Throws:
IllegalAccessException
InvocationTargetException

tryInvoke

public Object tryInvoke(Object obj,
                        Object key)
Description copied from interface: JexlPropertyGet
Attempts to reuse this JexlPropertyGet, checking that it is compatible with the actual set of arguments.

Parameters:
obj - the object to invoke the property get upon
key - the property key to get
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–2017 The Apache Software Foundation. All rights reserved.