public class MethodFactory extends ExecutableFactory
CtMethod
sub-factory.Modifier and Type | Field and Description |
---|---|
java.util.Set<CtMethod<?>> |
OBJECT_METHODS |
factory
Constructor and Description |
---|
MethodFactory(Factory factory)
Creates a new method sub-factory.
|
Modifier and Type | Method and Description |
---|---|
<R,B extends R> |
create(CtClass<?> target,
java.util.Set<ModifierKind> modifiers,
CtTypeReference<R> returnType,
java.lang.String name,
java.util.List<CtParameter<?>> parameters,
java.util.Set<CtTypeReference<? extends java.lang.Throwable>> thrownTypes,
CtBlock<B> body)
Creates a method.
|
<T> CtMethod<T> |
create(CtType<?> target,
CtMethod<T> source,
boolean redirectReferences)
Creates a method by copying an existing method.
|
<T> CtMethod<T> |
create(CtType<?> target,
java.util.Set<ModifierKind> modifiers,
CtTypeReference<T> returnType,
java.lang.String name,
java.util.List<CtParameter<?>> parameters,
java.util.Set<CtTypeReference<? extends java.lang.Throwable>> thrownTypes)
Creates an empty method.
|
<T> CtExecutableReference<T> |
createReference(CtMethod<T> m)
Creates a method reference.
|
<T> CtExecutableReference<T> |
createReference(java.lang.reflect.Method method)
Creates a method reference from an actual method.
|
java.util.Collection<CtMethod<java.lang.Void>> |
getMainMethods()
Gets all the main methods stored in this factory.
|
createAnonymous, createParameter, createParameterReference, createReference, createReference, createReference, createReference, createReference, createReference
public final java.util.Set<CtMethod<?>> OBJECT_METHODS
public MethodFactory(Factory factory)
factory
- the parent factorypublic <R,B extends R> CtMethod<R> create(CtClass<?> target, java.util.Set<ModifierKind> modifiers, CtTypeReference<R> returnType, java.lang.String name, java.util.List<CtParameter<?>> parameters, java.util.Set<CtTypeReference<? extends java.lang.Throwable>> thrownTypes, CtBlock<B> body)
target
- the class where the method is insertedmodifiers
- the modifiersreturnType
- the method's return typename
- the method's nameparameters
- the parametersthrownTypes
- the thrown typesbody
- the method's bodypublic <T> CtMethod<T> create(CtType<?> target, CtMethod<T> source, boolean redirectReferences)
T
- the type of the methodtarget
- the target type where the new method has to be inserted tosource
- the source method to be copiedredirectReferences
- tells if all the references to the owning type of the source
method should be redirected to the target type (true is
recommended for most uses)public <T> CtMethod<T> create(CtType<?> target, java.util.Set<ModifierKind> modifiers, CtTypeReference<T> returnType, java.lang.String name, java.util.List<CtParameter<?>> parameters, java.util.Set<CtTypeReference<? extends java.lang.Throwable>> thrownTypes)
target
- the class where the method is insertedmodifiers
- the modifiersreturnType
- the method's return typename
- the method's nameparameters
- the parametersthrownTypes
- the thrown typespublic <T> CtExecutableReference<T> createReference(CtMethod<T> m)
public <T> CtExecutableReference<T> createReference(java.lang.reflect.Method method)
public java.util.Collection<CtMethod<java.lang.Void>> getMainMethods()
Copyright © 2007–2021 Inria. All rights reserved.