Class DefaultJavaPackage

    • Field Detail

      • name

        private java.lang.String name
      • classes

        private java.util.List<JavaClass> classes
    • Constructor Detail

      • DefaultJavaPackage

        public DefaultJavaPackage​(java.lang.String name)
        Parameters:
        name - the name of the package, should never be null
    • Method Detail

      • getName

        public java.lang.String getName()
        Equivalent of Package.getName()
        Specified by:
        getName in interface JavaPackage
        Returns:
        the name, should never be null
      • setName

        public void setName​(java.lang.String name)
      • getCodeBlock

        public java.lang.String getCodeBlock()
        Specified by:
        getCodeBlock in interface JavaModel
        Returns:
        the codeblock
      • setClassLibrary

        public void setClassLibrary​(ClassLibrary classLibrary)
      • addClass

        public void addClass​(JavaClass clazz)
      • getClasses

        public java.util.Collection<JavaClass> getClasses()
        Returns all the classes found for the package.
        Specified by:
        getClasses in interface JavaPackage
        Returns:
        all the classes found for the package, never null
      • getClassByName

        public JavaClass getClassByName​(java.lang.String name)
        Try to get any class of this package by name. The name can be both the fully qualified name or just the name of the class.
        Specified by:
        getClassByName in interface JavaPackage
        Parameters:
        name - the (fully qualified) name of the class
        Returns:
        the matching class, otherwise null
      • getParentPackage

        public JavaPackage getParentPackage()
        The parent of this package For instance: the package of java.lang.reflect is java.lang
        Specified by:
        getParentPackage in interface JavaPackage
        Returns:
        the parent package, otherwise null
      • getSubPackages

        public java.util.List<JavaPackage> getSubPackages()
        For instance: one of the children of java.lang would be java.lang.reflect
        Specified by:
        getSubPackages in interface JavaPackage
        Returns:
        all the children of this package , never null
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Description copied from interface: JavaPackage
        Equivalent of Package.toString()
        Specified by:
        toString in interface JavaPackage
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string representation of the package.