| java.lang.Object spoon.template.Substitution
Substitution | abstract public class Substitution (Code) | | This class defines the substitution API for templates (see
Template ).
|
Method Summary | |
public static void | insertAll(CtType> targetType, Template template) Inserts all the methods, fields, constructors, initialization blocks (if
target is a class), inner types, and super interfaces (except
Template ) from a given template by substituting all the template
parameters by their values. | public static void | insertAllConstructors(CtType> targetType, Template template) Inserts all constructors and initialization blocks from a given template
by substituting all the template parameters by their values. | public static void | insertAllFields(CtType> targetType, Template template) Inserts all the fields from a given template by substituting all the
template parameters by their values. | public static void | insertAllMethods(CtType> targetType, Template template) Inserts all the methods from a given template by substituting all the
template parameters by their values. | public static void | insertAllSuperInterfaces(CtType> targetType, Template template) Inserts all the super interfaces (except
Template ) from a given
template by substituting all the template parameters by their values. | public static CtConstructor<T> | insertConstructor(CtClass<T> targetClass, Template template, CtMethod> sourceMethod) Generates a constructor from a template method by substituting all the
template parameters by their values. | public static CtConstructor<T> | insertConstructor(CtClass<T> targetClass, Template template, CtConstructor> sourceConstructor) Generates a constructor from a template constructor by substituting all
the template parameters by their values. | public static CtField<T> | 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. | public static CtMethod<T> | insertMethod(CtType> targetType, Template template, CtMethod<T> sourceMethod) Generates a method from a template method by substituting all the
template parameters by their values. | public static void | redirectTypeReferences(CtElement element, CtTypeReference> source, CtTypeReference> target) A helper method that recursively redirects all the type references from a
source type to a target type in the given element. | public static E | substitute(CtSimpleType> targetType, Template template, E code) Substitutes all the template parameters in a random piece of code. | public static T | substitute(Template template, T templateType) Substitutes all the template parameters in a given template type and
returns the resulting type. | public static CtExpression> | substituteFieldDefaultExpression(CtSimpleType> targetType, Template template, String fieldName) Gets a default expression from a template field with all the template
parameters substituted. | public static CtBlock> | substituteMethodBody(CtClass> targetClass, Template template, String executableName, CtTypeReference>... parameterTypes) Gets a body from a template executable with all the template parameters
substituted. |
insertAll | public static void insertAll(CtType> targetType, Template template)(Code) | | Inserts all the methods, fields, constructors, initialization blocks (if
target is a class), inner types, and super interfaces (except
Template ) from a given template by substituting all the template
parameters by their values. Members annotated with
spoon.template.Local or
Parameter are not inserted.
Parameters: targetType - the target type Parameters: template - the source template |
insertAllConstructors | public static void insertAllConstructors(CtType> targetType, Template template)(Code) | | Inserts all constructors and initialization blocks from a given template
by substituting all the template parameters by their values. Members
annotated with
spoon.template.Local or
Parameter are not
inserted.
Parameters: targetType - the target type Parameters: template - the source template |
insertAllFields | public static void insertAllFields(CtType> targetType, Template template)(Code) | | Inserts all the fields from a given template by substituting all the
template parameters by their values. Members annotated with
spoon.template.Local or
Parameter are not inserted.
Parameters: targetType - the target type Parameters: template - the source template |
insertAllMethods | public static void insertAllMethods(CtType> targetType, Template template)(Code) | | Inserts all the methods from a given template by substituting all the
template parameters by their values. Members annotated with
spoon.template.Local or
Parameter are not inserted.
Parameters: targetType - the target type Parameters: template - the source template |
insertAllSuperInterfaces | public static void insertAllSuperInterfaces(CtType> targetType, Template template)(Code) | | Inserts all the super interfaces (except
Template ) from a given
template by substituting all the template parameters by their values.
Parameters: targetType - the target type Parameters: template - the source template |
insertConstructor | public static CtConstructor<T> insertConstructor(CtClass<T> targetClass, Template template, CtMethod> sourceMethod)(Code) | | Generates a constructor from a template method by substituting all the
template parameters by their values.
Parameters: targetClass - the target class where to insert the generated constructor Parameters: template - the template instance that holds the source template methodand that defines the parameter values Parameters: sourceMethod - the source template method the generated method |
insertConstructor | public static CtConstructor<T> insertConstructor(CtClass<T> targetClass, Template template, CtConstructor> sourceConstructor)(Code) | | Generates a constructor from a template constructor by substituting all
the template parameters by their values.
Parameters: targetClass - the target class where to insert the generated constructor Parameters: template - the template instance that holds the source templateconstructor and that defines the parameter values Parameters: sourceConstructor - the source template constructor the generated constructor |
insertField | public static CtField<T> insertField(CtType> targetType, Template template, CtField<T> sourceField)(Code) | | Generates a field (and its initialization expression) from a template
field by substituting all the template parameters by their values.
< Parameters: T - >the type of the field Parameters: targetType - the target type where the field is inserted Parameters: template - the template that defines the source template field Parameters: sourceField - the source template field the inserted field |
insertMethod | public static CtMethod<T> insertMethod(CtType> targetType, Template template, CtMethod<T> sourceMethod)(Code) | | Generates a method from a template method by substituting all the
template parameters by their values.
Parameters: targetType - the target type where to insert the generated method Parameters: template - the template instance that holds the source template methodand that defines the parameter values Parameters: sourceMethod - the source template method the generated method |
redirectTypeReferences | public static void redirectTypeReferences(CtElement element, CtTypeReference> source, CtTypeReference> target)(Code) | | A helper method that recursively redirects all the type references from a
source type to a target type in the given element.
|
substitute | public static E substitute(CtSimpleType> targetType, Template template, E code)(Code) | | Substitutes all the template parameters in a random piece of code.
Parameters: targetType - the target type Parameters: template - the template instance Parameters: code - the code the code where all the template parameters has be substituted bytheir values |
substitute | public static T substitute(Template template, T templateType)(Code) | | Substitutes all the template parameters in a given template type and
returns the resulting type.
Parameters: template - the template instance (holds the parameter values) Parameters: templateType - the template type a copy of the template type where all the parameters has beensubstituted |
substituteFieldDefaultExpression | public static CtExpression> substituteFieldDefaultExpression(CtSimpleType> targetType, Template template, String fieldName)(Code) | | Gets a default expression from a template field with all the template
parameters substituted.
Parameters: targetType - the target type Parameters: template - the template that holds the field Parameters: fieldName - the template source field the expression of the template source field with all the templateparameters substituted |
substituteMethodBody | public static CtBlock> substituteMethodBody(CtClass> targetClass, Template template, String executableName, CtTypeReference>... parameterTypes)(Code) | | Gets a body from a template executable with all the template parameters
substituted.
Parameters: targetClass - the target class Parameters: template - the template that holds the executable Parameters: executableName - the source executable template Parameters: parameterTypes - the parameter types of the source executable the body expression of the source executable template with allthe template parameters substituted |
|
|