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
Modifier and TypeMethodDescriptionaddParameter(Class<?> type, String name) Add a parameter with the specifiedClasstype and name to this methodaddParameter(String type, String name) Add a parameter with the specified type and name to this methodaddParameter(JavaType<?> type, String name) Add a parameter with the specifiedJavaTypetype and name to this methodAdd a thrownExceptionto this method's signature.Add a thrownExceptionto this method's signature.Get a list of thisMethod's parameters.removeParameter(Class<?> type, String name) Remove a parameter with the specifiedClasstype and name from this methodremoveParameter(String type, String name) Remove a parameter with the specified type and name from this methodremoveParameter(JavaType<?> type, String name) Remove a parameter with the specifiedJavaTypetype and name to this methodremoveParameter(ParameterSource<O> parameter) Remove a parameter from this methodremoveThrows(Class<? extends Exception> type) Remove a thrownExceptionto this method's signature.removeThrows(String type) Remove a thrownExceptionto this method's signature.Set the inner body of thisMethodsetConstructor(boolean constructor) Toggle this method as a constructor.setDefault(boolean value) Sets the default keyword in this methodsetNative(boolean value) Sets this method to be native IMPORTANT: Setting it totruewill remove the method body.setParameters(String string) Set thisMethod's parameters.setReturnType(Class<?> type) Set thisMethodto return the given type.setReturnType(String type) Set thisMethodto return the given type.setReturnType(JavaType<?> type) Set thisMethodto return the given type.setReturnType(Type<?> type) Set thisMethodto return the given type.Set thisMethodto return 'void'setSynchronized(boolean value) Sets the synchronized keyword in this element.Methods inherited from interface org.jboss.forge.roaster.model.Abstractable
isAbstractMethods inherited from interface org.jboss.forge.roaster.model.source.AbstractableSource
setAbstractMethods inherited from interface org.jboss.forge.roaster.model.AnnotationTarget
hasAnnotation, hasAnnotationMethods inherited from interface org.jboss.forge.roaster.model.source.AnnotationTargetSource
addAnnotation, addAnnotation, addAnnotation, getAnnotation, getAnnotation, getAnnotations, removeAllAnnotations, removeAnnotationMethods inherited from interface org.jboss.forge.roaster.model.FinalCapable
isFinalMethods inherited from interface org.jboss.forge.roaster.model.source.FinalCapableSource
setFinalMethods inherited from interface org.jboss.forge.roaster.model.GenericCapable
hasTypeVariableMethods inherited from interface org.jboss.forge.roaster.model.source.GenericCapableSource
addTypeVariable, addTypeVariable, getTypeVariable, getTypeVariables, removeTypeVariable, removeTypeVariableMethods inherited from interface org.jboss.forge.roaster.Internal
getInternalMethods inherited from interface org.jboss.forge.roaster.model.JavaDocCapable
hasJavaDocMethods inherited from interface org.jboss.forge.roaster.model.source.JavaDocCapableSource
getJavaDoc, removeJavaDocMethods inherited from interface org.jboss.forge.roaster.model.source.LocationCapable
getColumnNumber, getEndPosition, getLineNumber, getStartPositionMethods inherited from interface org.jboss.forge.roaster.model.Method
getBody, getReturnType, getThrownExceptions, isConstructor, isDefault, isNative, isReturnTypeVoid, isSynchronized, toSignatureMethods inherited from interface org.jboss.forge.roaster.model.source.NamedSource
setNameMethods inherited from interface org.jboss.forge.roaster.model.StaticCapable
isStaticMethods inherited from interface org.jboss.forge.roaster.model.source.StaticCapableSource
setStaticMethods inherited from interface org.jboss.forge.roaster.model.VisibilityScoped
getVisibility, isPackagePrivate, isPrivate, isProtected, isPublicMethods inherited from interface org.jboss.forge.roaster.model.source.VisibilityScopedSource
setPackagePrivate, setPrivate, setProtected, setPublic, setVisibility
-
Method Details
-
setDefault
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
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
Sets this method to be native IMPORTANT: Setting it totruewill remove the method body. -
setReturnType
Set thisMethodto return the given type. The type is properly imported if possible.- Parameters:
type- the return type- Returns:
- this
- See Also:
-
setReturnType
Set thisMethodto return the given type. The type is properly imported if possible.- Parameters:
type- the return type- Returns:
- this
- See Also:
-
setReturnType
Set thisMethodto return the given type. The type is properly imported if possible.- Parameters:
type- the return type- Returns:
- this
- See Also:
-
setReturnType
Set thisMethodto return the given type. The type is properly imported if possible.- Parameters:
type- the return type- Returns:
- this
- See Also:
-
setReturnTypeVoid
MethodSource<O> setReturnTypeVoid()Set thisMethodto return 'void' -
setBody
Set the inner body of thisMethod -
setConstructor
-
setParameters
Set thisMethod's parameters. -
addThrows
Add a thrownExceptionto this method's signature. -
addThrows
Add a thrownExceptionto this method's signature. -
removeThrows
Remove a thrownExceptionto this method's signature. -
removeThrows
Remove a thrownExceptionto this method's signature. -
getParameters
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
Add a parameter with the specifiedClasstype and name to this method -
addParameter
Add a parameter with the specified type and name to this method -
addParameter
Add a parameter with the specifiedJavaTypetype and name to this method -
removeParameter
Remove a parameter from this method -
removeParameter
Remove a parameter with the specifiedClasstype and name from this method -
removeParameter
Remove a parameter with the specified type and name from this method -
removeParameter
Remove a parameter with the specifiedJavaTypetype and name to this method
-