Package spoon.support.template
Class Parameters
java.lang.Object
spoon.support.template.Parameters
This class defines an API to manipulate template parameters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static StringThe prefix "_FIELD_" for a parameter that represents a fields in order to avoid name clashes. -
Method Summary
Modifier and TypeMethodDescriptiongetAllTemplateParameterFields(Class<? extends Template<?>> clazz, Factory factory)returns all the compile_time fields of a template representing a template parametergetAllTemplateParameterFields(Class<? extends Template> clazz)returns all the runtime fields of a template representing a template parameterstatic IntegergetIndex(CtExpression<?> e)Gets the index of a one-dimension array (helper).Gets the names of all the template parameters of a given template type (including the ones defined by the super types).getNamesToValues(Template<?> template, CtClass<? extends Template<?>> templateType)Gets the Map of names to template parameter value for all the template parameters of a given template type (including the ones defined by the super types).static CtField<?>getParameterField(CtClass<? extends Template<?>> templateClass, String parameterName)getTemplateParametersAsMap(Factory f, Template<?> template)Gets the Map of names to template parameter values for all the template parameters of a given template type + adds mapping of template model reference to target type as parameter toostatic ObjectGets a template field parameter value.static booleanisParameterSource(Field field)Tells if a given field is a template parameter.static booleanisParameterSource(CtFieldReference<?> ref)Tells if a given field is a template parameter.static voidSets a template field parameter value.
-
Field Details
-
fieldPrefix
The prefix "_FIELD_" for a parameter that represents a fields in order to avoid name clashes.- See Also:
- Constant Field Values
-
-
Method Details
-
getIndex
Gets the index of a one-dimension array (helper). -
getValue
Gets a template field parameter value. -
getParameterField
-
setValue
public static void setValue(Template<?> template, String parameterName, Integer index, Object value)Sets a template field parameter value. -
getNames
Gets the names of all the template parameters of a given template type (including the ones defined by the super types). -
getNamesToValues
public static Map<String,Object> getNamesToValues(Template<?> template, CtClass<? extends Template<?>> templateType)Gets the Map of names to template parameter value for all the template parameters of a given template type (including the ones defined by the super types). -
getTemplateParametersAsMap
Gets the Map of names to template parameter values for all the template parameters of a given template type + adds mapping of template model reference to target type as parameter too- Parameters:
f- the factorytargetType- the target type of the substitution (can be null), which will be done with result parameterstemplate- the template that holds the parameter values
-
isParameterSource
Tells if a given field is a template parameter. -
isParameterSource
Tells if a given field is a template parameter. -
getAllTemplateParameterFields
returns all the runtime fields of a template representing a template parameter -
getAllTemplateParameterFields
public static List<CtField<?>> getAllTemplateParameterFields(Class<? extends Template<?>> clazz, Factory factory)returns all the compile_time fields of a template representing a template parameter
-