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_MERGEFields inherited from interface spoon.pattern.internal.parameter.ParameterInfo
UNLIMITED_OCCURRENCES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectaddValueAs(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> voidgetValueAs(Factory factory, ResultHolder<T> result, ImmutableMap parameters)Takes the value of parameter identified by thisParameterInfofrom the `parameters` and adds that 0, 1 or more values into result (depending on type of result)protected StringgetWrappedName(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:
getPlainNamein classAbstractParameterInfo
-
getWrappedName
- Specified by:
getWrappedNamein classAbstractParameterInfo
-
addValueAs
Description copied from class:AbstractParameterInfotakes 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:
addValueAsin 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:
getEmptyContainerin classAbstractParameterInfo
-
getValueAs
Description copied from interface:ParameterInfoTakes the value of parameter identified by thisParameterInfofrom the `parameters` and adds that 0, 1 or more values into result (depending on type of result)- Specified by:
getValueAsin interfaceParameterInfo- Overrides:
getValueAsin 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
-