Interface JavaSource

  • All Known Implementing Classes:
    DefaultJavaSource

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

      • getURL

        java.net.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

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

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

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

        java.lang.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​(java.lang.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​(java.lang.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
      • getPackageName

        java.lang.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