DevFaqJavaModelResourceToClassDefinition

How do I get a JavaClass from a Resource?

Note: This FAQ item applies only to NetBeans 4.x and 5.x. The Java parsing infrastructure in NetBeans 6 has been replaced with a new API.

for (Iterator i=resource.getClassifiers().iterator(); i.hasNext();) {
    JavaClass curr = (JavaClass) i.next();
    // do something
}

This will iterate through all top-level classes in a given source file (in most cases there is only one top-level class).

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo