Interface MethodSource<O extends JavaSource<O>>
-
- All Superinterfaces:
Abstractable,AbstractableSource<MethodSource<O>>,AnnotationTarget<O>,AnnotationTargetSource<O,MethodSource<O>>,FinalCapable,FinalCapableSource<MethodSource<O>>,GenericCapable<O>,GenericCapableSource<O,MethodSource<O>>,Internal,JavaDocCapable<MethodSource<O>>,JavaDocCapableSource<MethodSource<O>>,LocationCapable,Member<O>,MemberSource<O,MethodSource<O>>,Method<O,MethodSource<O>>,Named,NamedSource<MethodSource<O>>,Origin<O>,StaticCapable,StaticCapableSource<MethodSource<O>>,VisibilityScoped,VisibilityScopedSource<MethodSource<O>>
public interface MethodSource<O extends JavaSource<O>> extends Method<O,MethodSource<O>>, AbstractableSource<MethodSource<O>>, MemberSource<O,MethodSource<O>>, GenericCapableSource<O,MethodSource<O>>
Represents a Java Method in source form.- Author:
- Lincoln Baxter, III, George Gastaldi
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ParameterSource<O>addParameter(java.lang.Class<?> type, java.lang.String name)Add a parameter with the specifiedClasstype and name to this methodParameterSource<O>addParameter(java.lang.String type, java.lang.String name)Add a parameter with the specified type and name to this methodParameterSource<O>addParameter(JavaType<?> type, java.lang.String name)Add a parameter with the specifiedJavaTypetype and name to this methodMethodSource<O>addThrows(java.lang.Class<? extends java.lang.Exception> type)Add a thrownExceptionto this method's signature.MethodSource<O>addThrows(java.lang.String type)Add a thrownExceptionto this method's signature.java.util.List<ParameterSource<O>>getParameters()Get a list of thisMethod's parameters.MethodSource<O>removeParameter(java.lang.Class<?> type, java.lang.String name)Remove a parameter with the specifiedClasstype and name from this methodMethodSource<O>removeParameter(java.lang.String type, java.lang.String name)Remove a parameter with the specified type and name from this methodMethodSource<O>removeParameter(JavaType<?> type, java.lang.String name)Remove a parameter with the specifiedJavaTypetype and name to this methodMethodSource<O>removeParameter(ParameterSource<O> parameter)Remove a parameter from this methodMethodSource<O>removeThrows(java.lang.Class<? extends java.lang.Exception> type)Remove a thrownExceptionto this method's signature.MethodSource<O>removeThrows(java.lang.String type)Remove a thrownExceptionto this method's signature.MethodSource<O>setBody(java.lang.String body)Set the inner body of thisMethodMethodSource<O>setConstructor(boolean constructor)Toggle this method as a constructor.MethodSource<O>setDefault(boolean value)Sets the default keyword in this methodMethodSource<O>setNative(boolean value)Sets this method to be native IMPORTANT: Setting it totruewill remove the method body.MethodSource<O>setParameters(java.lang.String string)Set thisMethod's parameters.MethodSource<O>setReturnType(java.lang.Class<?> type)Set thisMethodto return the given type.MethodSource<O>setReturnType(java.lang.String type)Set thisMethodto return the given type.MethodSource<O>setReturnType(JavaType<?> type)Set thisMethodto return the given type.MethodSource<O>setReturnType(Type<?> type)Set thisMethodto return the given type.MethodSource<O>setReturnTypeVoid()Set thisMethodto return 'void'MethodSource<O>setSynchronized(boolean value)Sets the synchronized keyword in this element.-
Methods inherited from interface org.jboss.forge.roaster.model.Abstractable
isAbstract
-
Methods inherited from interface org.jboss.forge.roaster.model.source.AbstractableSource
setAbstract
-
Methods inherited from interface org.jboss.forge.roaster.model.AnnotationTarget
hasAnnotation, hasAnnotation
-
Methods inherited from interface org.jboss.forge.roaster.model.source.AnnotationTargetSource
addAnnotation, addAnnotation, addAnnotation, getAnnotation, getAnnotation, getAnnotations, removeAllAnnotations, removeAnnotation
-
Methods inherited from interface org.jboss.forge.roaster.model.FinalCapable
isFinal
-
Methods inherited from interface org.jboss.forge.roaster.model.source.FinalCapableSource
setFinal
-
Methods inherited from interface org.jboss.forge.roaster.model.GenericCapable
hasTypeVariable
-
Methods inherited from interface org.jboss.forge.roaster.model.source.GenericCapableSource
addTypeVariable, addTypeVariable, getTypeVariable, getTypeVariables, removeTypeVariable, removeTypeVariable
-
Methods inherited from interface org.jboss.forge.roaster.Internal
getInternal
-
Methods inherited from interface org.jboss.forge.roaster.model.JavaDocCapable
hasJavaDoc
-
Methods inherited from interface org.jboss.forge.roaster.model.source.JavaDocCapableSource
getJavaDoc, removeJavaDoc
-
Methods inherited from interface org.jboss.forge.roaster.model.source.LocationCapable
getColumnNumber, getEndPosition, getLineNumber, getStartPosition
-
Methods inherited from interface org.jboss.forge.roaster.model.Method
getBody, getReturnType, getThrownExceptions, isConstructor, isDefault, isNative, isReturnTypeVoid, isSynchronized, toSignature
-
Methods inherited from interface org.jboss.forge.roaster.model.source.NamedSource
setName
-
Methods inherited from interface org.jboss.forge.roaster.model.StaticCapable
isStatic
-
Methods inherited from interface org.jboss.forge.roaster.model.source.StaticCapableSource
setStatic
-
Methods inherited from interface org.jboss.forge.roaster.model.VisibilityScoped
getVisibility, isPackagePrivate, isPrivate, isProtected, isPublic
-
Methods inherited from interface org.jboss.forge.roaster.model.source.VisibilityScopedSource
setPackagePrivate, setPrivate, setProtected, setPublic, setVisibility
-
-
-
-
Method Detail
-
setDefault
MethodSource<O> setDefault(boolean value)
Sets the default keyword in this method- Parameters:
value- if this method should have the default keywork set- Returns:
- the generic element this interface is bound to
-
setSynchronized
MethodSource<O> setSynchronized(boolean value)
Sets the synchronized keyword in this element.- Parameters:
value- if this element should be set to synchronized- Returns:
- the generic element this interface is bound to
-
setNative
MethodSource<O> setNative(boolean value)
Sets this method to be native IMPORTANT: Setting it totruewill remove the method body.
-
setReturnType
MethodSource<O> setReturnType(java.lang.Class<?> type)
Set thisMethodto return the given type. The type is properly imported if possible.- Parameters:
type- the return type- Returns:
- this
- See Also:
Importer.addImport(String)
-
setReturnType
MethodSource<O> setReturnType(java.lang.String type)
Set thisMethodto return the given type. The type is properly imported if possible.- Parameters:
type- the return type- Returns:
- this
- See Also:
Importer.addImport(String)
-
setReturnType
MethodSource<O> setReturnType(JavaType<?> type)
Set thisMethodto return the given type. The type is properly imported if possible.- Parameters:
type- the return type- Returns:
- this
- See Also:
Importer.addImport(String)
-
setReturnType
MethodSource<O> setReturnType(Type<?> type)
Set thisMethodto return the given type. The type is properly imported if possible.- Parameters:
type- the return type- Returns:
- this
- See Also:
Importer.addImport(String)
-
setReturnTypeVoid
MethodSource<O> setReturnTypeVoid()
Set thisMethodto return 'void'
-
setBody
MethodSource<O> setBody(java.lang.String body)
Set the inner body of thisMethod
-
setConstructor
MethodSource<O> setConstructor(boolean constructor)
-
setParameters
MethodSource<O> setParameters(java.lang.String string)
Set thisMethod's parameters.
-
addThrows
MethodSource<O> addThrows(java.lang.String type)
Add a thrownExceptionto this method's signature.
-
addThrows
MethodSource<O> addThrows(java.lang.Class<? extends java.lang.Exception> type)
Add a thrownExceptionto this method's signature.
-
removeThrows
MethodSource<O> removeThrows(java.lang.String type)
Remove a thrownExceptionto this method's signature.
-
removeThrows
MethodSource<O> removeThrows(java.lang.Class<? extends java.lang.Exception> type)
Remove a thrownExceptionto this method's signature.
-
getParameters
java.util.List<ParameterSource<O>> getParameters()
Get a list of thisMethod's parameters.- Specified by:
getParametersin interfaceMethod<O extends JavaSource<O>,MethodSource<O extends JavaSource<O>>>
-
addParameter
ParameterSource<O> addParameter(java.lang.Class<?> type, java.lang.String name)
Add a parameter with the specifiedClasstype and name to this method
-
addParameter
ParameterSource<O> addParameter(java.lang.String type, java.lang.String name)
Add a parameter with the specified type and name to this method
-
addParameter
ParameterSource<O> addParameter(JavaType<?> type, java.lang.String name)
Add a parameter with the specifiedJavaTypetype and name to this method
-
removeParameter
MethodSource<O> removeParameter(ParameterSource<O> parameter)
Remove a parameter from this method
-
removeParameter
MethodSource<O> removeParameter(java.lang.Class<?> type, java.lang.String name)
Remove a parameter with the specifiedClasstype and name from this method
-
removeParameter
MethodSource<O> removeParameter(java.lang.String type, java.lang.String name)
Remove a parameter with the specified type and name from this method
-
removeParameter
MethodSource<O> removeParameter(JavaType<?> type, java.lang.String name)
Remove a parameter with the specifiedJavaTypetype and name to this method
-
-