Package spoon.support.template
Class Parameters
java.lang.Object
spoon.support.template.Parameters
This class defines an API to manipulate template parameters.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static String
The 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 Integer
getIndex(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 Object
Gets a template field parameter value.static boolean
isParameterSource(Field field)
Tells if a given field is a template parameter.static boolean
isParameterSource(CtFieldReference<?> ref)
Tells if a given field is a template parameter.static void
Sets 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
-