Package spoon.pattern.internal.parameter
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`
-
-
Field Summary
-
Fields inherited from class spoon.pattern.internal.parameter.AbstractParameterInfo
NO_MERGE
-
Fields inherited from interface spoon.pattern.internal.parameter.ParameterInfo
UNLIMITED_OCCURRENCES
-
-
Constructor Summary
Constructors Constructor Description ComputedParameterInfo(ParameterComputer computer, ParameterInfo next)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
addValueAs(Object container, Function<Object,Object> merger)
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 itprotected List<Object>
getEmptyContainer()
protected String
getPlainName()
<T> void
getValueAs(Factory factory, ResultHolder<T> result, ImmutableMap parameters)
Takes the value of parameter identified by thisParameterInfo
from the `parameters` and adds that 0, 1 or more values into result (depending on type of result)protected String
getWrappedName(String containerName)
-
Methods inherited from class spoon.pattern.internal.parameter.AbstractParameterInfo
addValueAs, addValueToContainer, castTo, convertSingleValue, convertValue, getContainerKind, getContainerKind, getContainerKind, getContainerKindAccessor, getContainerName, getMatchingStrategy, getMaxOccurrences, getMinOccurrences, getName, getParameterValueType, getValue, getValueConvertor, isMandatory, isMultiple, isRepeatable, isTryNextMatch, matches, merge, mergeSingle, setContainerKind, setMatchCondition, setMatchingStrategy, setMaxOccurrences, setMinOccurrences, setParameterValueType, setRepeatable, setValueConvertor, toString
-
-
-
-
Constructor Detail
-
ComputedParameterInfo
public ComputedParameterInfo(ParameterComputer computer, ParameterInfo next)
-
-
Method Detail
-
getPlainName
protected String getPlainName()
- Specified by:
getPlainName
in classAbstractParameterInfo
-
getWrappedName
protected String getWrappedName(String containerName)
- Specified by:
getWrappedName
in classAbstractParameterInfo
-
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 classAbstractParameterInfo
- Parameters:
container
- a container of valuesmerger
- 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 classAbstractParameterInfo
-
getValueAs
public <T> void getValueAs(Factory factory, ResultHolder<T> result, ImmutableMap parameters)
Description copied from interface:ParameterInfo
Takes the value of parameter identified by thisParameterInfo
from the `parameters` and adds that 0, 1 or more values into result (depending on type of result)- Specified by:
getValueAs
in interfaceParameterInfo
- Overrides:
getValueAs
in classAbstractParameterInfo
- 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 valueparameters
- here are stored all the parameter values
-
-