Package eu.bandm.tools.paisley
Interface ReflectionPatterns.Access<A>
- Type Parameters:
A- the target type of objects to extract from
- All Superinterfaces:
CachedTransform.TryApply<A,Object>
- Enclosing class:
ReflectionPatterns
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public static interface ReflectionPatterns.Access<A>
extends CachedTransform.TryApply<A,Object>
A function that extracts data from a target object by reflection.
-
Method Summary
-
Method Details
-
access
Returns data extracted from the given object by reflection.- Parameters:
target- an object to extract data from- Returns:
- data extracted from
targetby reflection - Throws:
IllegalAccessException- if reflection is enforcing Java language access control and the underlying member is inaccessible.InvocationTargetException- if the underlying method throws an exception.IllegalArgumentException- if the target object or any given parameter value for an underlying method is not of the expected type.NullPointerException- iftargetis null and the access is not static.- See Also:
-
tryApply
Checks whether a target can be transformed and transforms it.This implementation invokes
access(A)and catches exceptions that may arise from the use of reflective operations.- Specified by:
tryApplyin interfaceCachedTransform.TryApply<A,Object> - Parameters:
target- the object to be matched against.- Returns:
- a target for
Unary.bodyto be matched against. - Throws:
CachedTransform.ApplyException- ifaccessthrows an exception of typeIllegalAccessException,IllegalArgumentException,NullPointerExceptionorInvocationTargetException; the caught exception is forwarded as a cause.- See Also:
-