Interface MethodHolderSource<O extends JavaSource<O>>
- All Superinterfaces:
MemberHolder<O>,MemberHolderSource<O>,MethodHolder<O>
- All Known Subinterfaces:
EnumConstantSource.Body,JavaClassSource,JavaEnumSource,JavaInterfaceSource,JavaRecordSource,PropertyHolderSource<O>
public interface MethodHolderSource<O extends JavaSource<O>>
extends MethodHolder<O>, MemberHolderSource<O>
Represents a
JavaSource that may declare methods.- Author:
- Lincoln Baxter, III
-
Method Summary
Modifier and TypeMethodDescriptionAdd an uninitializedMethodSourcedeclaration to thisMethodHolderSourceinstance.Add a newMethodSourcedeclaration to thisMethodHolderSourceinstance, using the givenMethodas the method declaration.Add a newMethodSourcedeclaration to thisMethodHolderSourceinstance, using the givenStringas the method declaration.Add a newMethodSourcedeclaration to thisMethodHolderSourceinstance, using the givenMethodas the method declaration.default MethodSource<O>Return theMethodSourcewith the given name and zero parameters; otherwise return null.default MethodSource<O>Return theMethodSourcewith the given name and signature types; otherwise return null.default MethodSource<O>Return theMethodSourcewith the given name and signature types; otherwise return null.Get aListof allMethodSources declared by thisMethodHolderSourceinstance, if any; otherwise, return an emptyListremoveMethod(Method<O, ?> method) Remove the givenMethodSourcedeclaration from thisMethodHolderSourceinstance, if it exists; otherwise, do nothing.Methods inherited from interface org.jboss.forge.roaster.model.source.MemberHolderSource
getMembersMethods inherited from interface org.jboss.forge.roaster.model.MethodHolder
hasMethod, hasMethodSignature, hasMethodSignature, hasMethodSignature, hasMethodSignature
-
Method Details
-
getMethod
Return theMethodSourcewith the given name and zero parameters; otherwise return null.- Specified by:
getMethodin interfaceMethodHolder<O extends JavaSource<O>>
-
getMethod
Return theMethodSourcewith the given name and signature types; otherwise return null.- Specified by:
getMethodin interfaceMethodHolder<O extends JavaSource<O>>
-
getMethod
Return theMethodSourcewith the given name and signature types; otherwise return null.- Specified by:
getMethodin interfaceMethodHolder<O extends JavaSource<O>>
-
getMethods
List<MethodSource<O>> getMethods()Get aListof allMethodSources declared by thisMethodHolderSourceinstance, if any; otherwise, return an emptyList- Specified by:
getMethodsin interfaceMethodHolder<O extends JavaSource<O>>
-
addMethod
MethodSource<O> addMethod()Add an uninitializedMethodSourcedeclaration to thisMethodHolderSourceinstance. ThisMethodSourcewill be a stub until further modified. -
addMethod
Add a newMethodSourcedeclaration to thisMethodHolderSourceinstance, using the givenStringas the method declaration. For example:
Method m = javaClass.addMethod("public String method() {return \"hello!\";}") -
addMethod
Add a newMethodSourcedeclaration to thisMethodHolderSourceinstance, using the givenMethodas the method declaration. AbstractMethodobjects are not implemented in this method. SeeMethods.implementMethod(MethodSource)for more information- Parameters:
method- TheMethodto be added- Returns:
- a
MethodSourcedeclaration based on theMethodparameter. - See Also:
-
addMethod
Add a newMethodSourcedeclaration to thisMethodHolderSourceinstance, using the givenMethodas the method declaration. AbstractMethodobjects are not implemented in this method. SeeMethods.implementMethod(MethodSource)for more information- Parameters:
method- TheMethodto be added- Returns:
- a
MethodSourcedeclaration based on theMethodparameter. - See Also:
-
removeMethod
Remove the givenMethodSourcedeclaration from thisMethodHolderSourceinstance, if it exists; otherwise, do nothing.
-