Class DefaultModelInterpolator.ObjectBasedValueSource

java.lang.Object
org.codehaus.plexus.interpolation.AbstractValueSource
org.apache.maven.internal.impl.model.DefaultModelInterpolator.ObjectBasedValueSource
All Implemented Interfaces:
org.codehaus.plexus.interpolation.ValueSource
Enclosing class:
DefaultModelInterpolator

public static class DefaultModelInterpolator.ObjectBasedValueSource extends org.codehaus.plexus.interpolation.AbstractValueSource
Wraps an object, providing reflective access to the object graph of which the supplied object is the root. Expressions like 'child.name' will translate into 'rootObject.getChild().getName()' for non-boolean properties, and 'rootObject.getChild().isName()' for boolean properties.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a new value source, using the supplied object as the root from which to start, and using expressions split at the dot ('.') to navigate the object graph beneath this root.
  • Method Summary

    Modifier and Type
    Method
    Description
    getValue(String expression)
    Split the expression into parts, tokenized on the dot ('.') character.

    Methods inherited from class org.codehaus.plexus.interpolation.AbstractValueSource

    addFeedback, addFeedback, clearFeedback, getFeedback

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ObjectBasedValueSource

      public ObjectBasedValueSource(Object root)
      Construct a new value source, using the supplied object as the root from which to start, and using expressions split at the dot ('.') to navigate the object graph beneath this root.
      Parameters:
      root - the root of the graph.
  • Method Details

    • getValue

      public Object getValue(String expression)

      Split the expression into parts, tokenized on the dot ('.') character. Then, starting at the root object contained in this value source, apply each part to the object graph below this root, using either 'getXXX()' or 'isXXX()' accessor types to resolve the value for each successive expression part. Finally, return the result of the last expression part's resolution.

      NOTE: The object-graph nagivation actually takes place via the ReflectionValueExtractor class.