Class ComputedParameterInfo

java.lang.Object
spoon.pattern.internal.parameter.AbstractParameterInfo
spoon.pattern.internal.parameter.ComputedParameterInfo
All Implemented Interfaces:
ParameterInfo

public class ComputedParameterInfo extends AbstractParameterInfo
Represents a parameter which is related to a value of another parameter. For example parameter which represents CtTypeReference has a value `abc.sample.AType` And computed parameter which represents name of type referenced by CtTypeReference has a computed String value `AType`
  • Constructor Details

  • Method Details

    • getPlainName

      protected String getPlainName()
      Specified by:
      getPlainName in class AbstractParameterInfo
    • getWrappedName

      protected String getWrappedName(String containerName)
      Specified by:
      getWrappedName in class AbstractParameterInfo
    • addValueAs

      protected Object addValueAs(Object container, Function<Object,​Object> merger)
      Description copied from class: AbstractParameterInfo
      takes existing item value from the `container`, sends it as parameter into `merger` and get's new to be stored value stores that value into new `container` and returns it
      Specified by:
      addValueAs in class AbstractParameterInfo
      Parameters:
      container - a container of values
      merger - a code which merges existing value from container with new value and returns merged value, which has to be stored in the container instead
      Returns:
      copy of the container with merged value
    • getEmptyContainer

      protected List<Object> getEmptyContainer()
      Specified by:
      getEmptyContainer in class AbstractParameterInfo
    • getValueAs

      public <T> void getValueAs(Factory factory, ResultHolder<T> result, ImmutableMap parameters)
      Description copied from interface: ParameterInfo
      Takes the value of parameter identified by this ParameterInfo from the `parameters` and adds that 0, 1 or more values into result (depending on type of result)
      Specified by:
      getValueAs in interface ParameterInfo
      Overrides:
      getValueAs in class AbstractParameterInfo
      Parameters:
      factory - the factory used to create new entities if conversion of value is needed before it can be added into `result`
      result - the receiver of the result value. It defined required type of returned value and multiplicity of returned value
      parameters - here are stored all the parameter values