Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to find out if method is public using IMember or IType
How to find out if method is public using IMember or IType [message #243433] Thu, 03 May 2007 15:34 Go to next message
Eclipse UserFriend
Urgent help needed:

I would like to update method with Annotation and I would like to do it
only for public methods.

How I can figure out if method is public using IMethod or IType API ?
Re: How to find out if method is public using IMember or IType [message #243438 is a reply to message #243433] Fri, 04 May 2007 02:47 Go to previous messageGo to next message
Eclipse UserFriend
If you have the IMethod you can check

(method.getFlags() & Flags.AccPublic) != 0

You may also want to check method.isConstructor() and Flags.AccStatic
depending whether you want to include static methods and constructors or
not.


--Cam

Irene Levina wrote:

> Urgent help needed:

> I would like to update method with Annotation and I would like to do it
> only for public methods.

> How I can figure out if method is public using IMethod or IType API ?
Re: How to find out if method is public using IMember or IType [message #243443 is a reply to message #243438] Fri, 04 May 2007 09:42 Go to previous messageGo to next message
Eclipse UserFriend
Cameron Bateman a écrit :
> If you have the IMethod you can check
> (method.getFlags() & Flags.AccPublic) != 0
I would rather recommend:
Flags.isPublic(method.getFlags())
--
Olivier
Re: How to find out if method is public using IMember or IType [message #243454 is a reply to message #243443] Fri, 04 May 2007 12:57 Go to previous message
Eclipse UserFriend
> I would rather recommend:
> Flags.isPublic(method.getFlags())

Good point.
Previous Topic:Eclipse compiler and static initializers
Next Topic:java.lang.NoClassDefFoundError
Goto Forum:
  


Current Time: Sat May 10 15:57:41 EDT 2025

Powered by FUDForum. Page generated in 0.03746 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top