Class FieldBasedObjectInterpolator.InterpolateObjectAction
- java.lang.Object
-
- org.codehaus.plexus.interpolation.object.FieldBasedObjectInterpolator.InterpolateObjectAction
-
- All Implemented Interfaces:
java.security.PrivilegedAction
- Enclosing class:
- FieldBasedObjectInterpolator
private static final class FieldBasedObjectInterpolator.InterpolateObjectAction extends java.lang.Object implements java.security.PrivilegedAction
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.SetblacklistedFieldNamesprivate java.lang.String[]blacklistedPackagePrefixesprivate java.util.LinkedList<FieldBasedObjectInterpolator.InterpolationTarget>interpolationTargetsprivate BasicInterpolatorinterpolatorprivate RecursionInterceptorrecursionInterceptorprivate java.util.List<ObjectInterpolationWarning>warningCollector
-
Constructor Summary
Constructors Constructor Description InterpolateObjectAction(java.lang.Object target, BasicInterpolator interpolator, RecursionInterceptor recursionInterceptor, java.util.Set blacklistedFieldNames, java.util.Set blacklistedPackagePrefixes, java.util.List<ObjectInterpolationWarning> warningCollector)Setup an object graph traversal for the given target starting point.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidevaluateArray(java.lang.Object target, java.lang.String basePath)Traverse the elements of an array, and interpolate any qualified objects or add them to the traversal queue.private booleaninterpolateCollection(java.lang.Object obj, java.lang.String basePath, java.lang.reflect.Field field)private voidinterpolateMap(java.lang.Object obj, java.lang.String basePath, java.lang.reflect.Field field)private voidinterpolateObject(java.lang.Object obj, java.lang.String basePath, java.lang.reflect.Field field)private voidinterpolateString(java.lang.Object obj, java.lang.reflect.Field field)private booleanisQualifiedForInterpolation(java.lang.Class cls)Using the package-prefix blacklist, determine whether the given class is qualified for interpolation, or whether it should be ignored.private booleanisQualifiedForInterpolation(java.lang.reflect.Field field, java.lang.Class fieldType)Using the field-name blacklist and the primitive-field cache, determine whether the given field in the given class is qualified for interpolation.java.lang.Objectrun()As long as the traversal queue is non-empty, traverse the next object in the queue.private voidtraverseObjectWithParents(java.lang.Class cls, FieldBasedObjectInterpolator.InterpolationTarget target)Traverse the given object, interpolating any String fields and adding non-primitive field values to the interpolation queue for later processing.
-
-
-
Field Detail
-
interpolationTargets
private final java.util.LinkedList<FieldBasedObjectInterpolator.InterpolationTarget> interpolationTargets
-
interpolator
private final BasicInterpolator interpolator
-
blacklistedFieldNames
private final java.util.Set blacklistedFieldNames
-
blacklistedPackagePrefixes
private final java.lang.String[] blacklistedPackagePrefixes
-
warningCollector
private final java.util.List<ObjectInterpolationWarning> warningCollector
-
recursionInterceptor
private final RecursionInterceptor recursionInterceptor
-
-
Constructor Detail
-
InterpolateObjectAction
public InterpolateObjectAction(java.lang.Object target, BasicInterpolator interpolator, RecursionInterceptor recursionInterceptor, java.util.Set blacklistedFieldNames, java.util.Set blacklistedPackagePrefixes, java.util.List<ObjectInterpolationWarning> warningCollector)Setup an object graph traversal for the given target starting point. This will initialize a queue of objects to traverse and interpolate by adding the target object.
-
-
Method Detail
-
run
public java.lang.Object run()
As long as the traversal queue is non-empty, traverse the next object in the queue. If an interpolation error occurs, return it immediately.- Specified by:
runin interfacejava.security.PrivilegedAction
-
traverseObjectWithParents
private void traverseObjectWithParents(java.lang.Class cls, FieldBasedObjectInterpolator.InterpolationTarget target) throws InterpolationExceptionTraverse the given object, interpolating any String fields and adding non-primitive field values to the interpolation queue for later processing.- Throws:
InterpolationException
-
interpolateObject
private void interpolateObject(java.lang.Object obj, java.lang.String basePath, java.lang.reflect.Field field) throws java.lang.IllegalAccessException, InterpolationException- Throws:
java.lang.IllegalAccessExceptionInterpolationException
-
interpolateMap
private void interpolateMap(java.lang.Object obj, java.lang.String basePath, java.lang.reflect.Field field) throws java.lang.IllegalAccessException, InterpolationException- Throws:
java.lang.IllegalAccessExceptionInterpolationException
-
interpolateCollection
private boolean interpolateCollection(java.lang.Object obj, java.lang.String basePath, java.lang.reflect.Field field) throws java.lang.IllegalAccessException, InterpolationException- Throws:
java.lang.IllegalAccessExceptionInterpolationException
-
interpolateString
private void interpolateString(java.lang.Object obj, java.lang.reflect.Field field) throws java.lang.IllegalAccessException, InterpolationException- Throws:
java.lang.IllegalAccessExceptionInterpolationException
-
isQualifiedForInterpolation
private boolean isQualifiedForInterpolation(java.lang.Class cls)
Using the package-prefix blacklist, determine whether the given class is qualified for interpolation, or whether it should be ignored.
-
isQualifiedForInterpolation
private boolean isQualifiedForInterpolation(java.lang.reflect.Field field, java.lang.Class fieldType)Using the field-name blacklist and the primitive-field cache, determine whether the given field in the given class is qualified for interpolation. Primitive fields and fields listed in the blacklist will be ignored. The primitive-field cache is used to improve the performance of the reflective operations in this method, since this method is a hotspot.
-
evaluateArray
private void evaluateArray(java.lang.Object target, java.lang.String basePath) throws InterpolationExceptionTraverse the elements of an array, and interpolate any qualified objects or add them to the traversal queue.- Throws:
InterpolationException
-
-