Interface JavaSource

All Known Implementing Classes:
DefaultJavaSource

public interface JavaSource
The root of every JavaModel, even for those based on binary classes.
  • Method Details

    • getURL

      URL getURL()
      Returns:
      the URL of the source file
      Since:
      1.4
    • getPackage

      JavaPackage getPackage()
      The package of this source or null
      Returns:
      the package
    • getImports

      List<String> getImports()
      Retrieve all the import
      Returns:
      the imports, never null
    • getClasses

      List<JavaClass> getClasses()
      A List with all direct classes of this source, never null
      Returns:
      a list of JavaClasses, never null
    • getCodeBlock

      String getCodeBlock()
      Complete code representation of this source
      Returns:
      the code block of this source
    • getClassNamePrefix

      String getClassNamePrefix()
      If there's a package, return the packageName, followed by a dot, otherwise an empty String
      Returns:
      the class name prefix, otherwise an empty String
    • getNestedClassByName

      JavaClass getNestedClassByName(String name)
      Try to get the JavaClass child based on its name relative to the package. This doesn't try to resolve it by recursion.
      Parameters:
      name - the name of the class
      Returns:
      the resolved JavaClass, otherwise null
    • getClassByName

      JavaClass getClassByName(String name)
      Try to get any class of this source by name. The name can be both the fully qualified name or just the name of the class.
      Parameters:
      name - the (fully qualified) name of the class
      Returns:
      the matching class, otherwise null
      Since:
      2.0
    • getJavaClassLibrary

      ClassLibrary getJavaClassLibrary()
    • getPackageName

      String getPackageName()
      Returns the name of the package or an empty String if there's no package
      Returns:
      the package name, otherwise an empty String