Package spoon.pattern.internal.parameter
Class ComputedParameterInfo
java.lang.Object
spoon.pattern.internal.parameter.AbstractParameterInfo
spoon.pattern.internal.parameter.ComputedParameterInfo
- All Implemented Interfaces:
ParameterInfo
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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 String
<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 Details
-
ComputedParameterInfo
-
-
Method Details
-
getPlainName
- Specified by:
getPlainName
in classAbstractParameterInfo
-
getWrappedName
- Specified by:
getWrappedName
in classAbstractParameterInfo
-
addValueAs
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
- Specified by:
getEmptyContainer
in classAbstractParameterInfo
-
getValueAs
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
-