Uses of Interface
spoon.template.Template
-
Packages that use Template Package Description spoon.support.template This package defines the substitution and matching engines for Java templates.spoon.template This package defines a framework for well-typed pure-Java templates. -
-
Uses of Template in spoon.support.template
Methods in spoon.support.template with parameters of type Template Modifier and Type Method Description static Map<String,Object>
Parameters. 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 Map<String,Object>
Parameters. 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
Parameters. getValue(Template<?> template, String parameterName, Integer index)
Gets a template field parameter value.static void
Parameters. setValue(Template<?> template, String parameterName, Integer index, Object value)
Sets a template field parameter value.Method parameters in spoon.support.template with type arguments of type Template Modifier and Type Method Description static List<CtField<?>>
Parameters. getAllTemplateParameterFields(Class<? extends Template<?>> clazz, Factory factory)
returns all the compile_time fields of a template representing a template parameterstatic List<Field>
Parameters. getAllTemplateParameterFields(Class<? extends Template> clazz)
returns all the runtime fields of a template representing a template parameterstatic List<String>
Parameters. getNames(CtClass<? extends Template<?>> templateType)
Gets the names of all the template parameters of a given template type (including the ones defined by the super types).static Map<String,Object>
Parameters. 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<?>
Parameters. getParameterField(CtClass<? extends Template<?>> templateClass, String parameterName)
-
Uses of Template in spoon.template
Classes in spoon.template that implement Template Modifier and Type Class Description class
AbstractTemplate<T extends CtElement>
handles the well-formedness and helper methods of templatesclass
BlockTemplate
This class represents a template parameter that defines a void block statement directly expressed in Java (no returns).class
ExpressionTemplate<T>
This class represents an expression template parameter expressed in Java.class
ExtensionTemplate
Inserts all the methods, fields, constructors, initialization blocks (if target is a class), inner types, and super interfaces (exceptTemplate
) from a given template by substituting all the template parameters by their values.class
StatementTemplate
This class represents a template parameter that defines a statement list directly expressed in Java (no returns).Methods in spoon.template with type parameters of type Template Modifier and Type Method Description static <T extends Template<?>>
voidSubstitution. insertAll(CtType<?> targetType, T template)
Inserts all the methods, fields, constructors, initialization blocks (if target is a class), inner types, and super interfaces (exceptTemplate
) from a given template by substituting all the template parameters by their values.Methods in spoon.template with parameters of type Template Modifier and Type Method Description static <T> CtClass<T>
Substitution. getTemplateCtClass(Factory factory, Template<?> template)
static void
Substitution. insertAllConstructors(CtType<?> targetType, Template<?> template)
Inserts all constructors and initialization blocks from a given template by substituting all the template parameters by their values.static void
Substitution. insertAllFields(CtType<?> targetType, Template<?> template)
Inserts all the fields from a given template by substituting all the template parameters by their values.static void
Substitution. insertAllMethods(CtType<?> targetType, Template<?> template)
Inserts all the methods from a given template by substituting all the template parameters by their values.static void
Substitution. insertAllNestedTypes(CtType<?> targetType, Template<?> template)
Inserts all the nested types from a given template by substituting all the template parameters by their values.static void
Substitution. insertAllSuperInterfaces(CtType<?> targetType, Template<?> template)
Inserts all the super interfaces (exceptTemplate
) from a given template by substituting all the template parameters by their values.static <T> CtConstructor<T>
Substitution. insertConstructor(CtClass<T> targetClass, Template<?> template, CtConstructor<?> sourceConstructor)
Generates a constructor from a template constructor by substituting all the template parameters by their values.static <T> CtConstructor<T>
Substitution. insertConstructor(CtClass<T> targetClass, Template<?> template, CtMethod<?> sourceMethod)
Generates a constructor from a template method by substituting all the template parameters by their values.static <T> CtField<T>
Substitution. insertField(CtType<?> targetType, Template<?> template, CtField<T> sourceField)
Generates a field (and its initialization expression) from a template field by substituting all the template parameters by their values.static <T> CtMethod<T>
Substitution. insertMethod(CtType<?> targetType, Template<?> template, CtMethod<T> sourceMethod)
Generates a method from a template method by substituting all the template parameters by their values.static <E extends CtElement>
ESubstitution. substitute(CtType<?> targetType, Template<?> template, E code)
Substitutes all the template parameters in a random piece of code.static <T extends CtType<?>>
TSubstitution. substitute(Template<?> template, T templateType)
Substitutes all the template parameters in a given template type and returns the resulting type.static CtExpression<?>
Substitution. substituteFieldDefaultExpression(CtType<?> targetType, Template<?> template, String fieldName)
Gets a default expression from a template field with all the template parameters substituted.static CtBlock<?>
Substitution. substituteMethodBody(CtClass<?> targetClass, Template<?> template, String executableName, CtTypeReference<?>... parameterTypes)
Gets a body from a template executable with all the template parameters substituted.static CtStatement
Substitution. substituteStatement(CtClass<?> targetClass, Template<?> template, int statementIndex, String executableName, CtTypeReference<?>... parameterTypes)
Gets a statement from a template executable with all the template parameters substituted.
-