Package com.thoughtworks.qdox.model.impl
Class DefaultJavaPackage
- java.lang.Object
-
- com.thoughtworks.qdox.model.impl.AbstractJavaModel
-
- com.thoughtworks.qdox.model.impl.AbstractBaseJavaEntity
-
- com.thoughtworks.qdox.model.impl.DefaultJavaPackage
-
- All Implemented Interfaces:
JavaAnnotatedElement,JavaModel,JavaPackage,java.io.Serializable
public class DefaultJavaPackage extends AbstractBaseJavaEntity implements JavaPackage
The default implementation ofJavaPackage, representing aPackage.- Since:
- 1.9
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<JavaClass>classesprivate ClassLibraryclassLibraryprivate java.lang.Stringname
-
Constructor Summary
Constructors Constructor Description DefaultJavaPackage(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClass(JavaClass clazz)booleanequals(java.lang.Object o)JavaClassgetClassByName(java.lang.String name)Try to get any class of this package by name.java.util.Collection<JavaClass>getClasses()Returns all the classes found for the package.java.lang.StringgetCodeBlock()ClassLibrarygetJavaClassLibrary()TheClassLibraryof this package.java.lang.StringgetName()Equivalent ofPackage.getName()JavaPackagegetParentPackage()The parent of this package For instance: the package ofjava.lang.reflectisjava.langjava.util.List<JavaPackage>getSubPackages()For instance: one of the children ofjava.langwould bejava.lang.reflectinthashCode()voidsetClassLibrary(ClassLibrary classLibrary)voidsetName(java.lang.String name)java.lang.StringtoString()Equivalent ofPackage.toString()-
Methods inherited from class com.thoughtworks.qdox.model.impl.AbstractBaseJavaEntity
getAnnotations, getComment, getDeclaringClass, getNamedParameter, getSource, getTagByName, getTags, getTagsByName, setAnnotations, setComment, setSource, setTags
-
Methods inherited from class com.thoughtworks.qdox.model.impl.AbstractJavaModel
getLineNumber, getModelWriter, setLineNumber, setModelWriterFactory
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.thoughtworks.qdox.model.JavaAnnotatedElement
getAnnotations, getComment, getNamedParameter, getTagByName, getTags, getTagsByName
-
Methods inherited from interface com.thoughtworks.qdox.model.JavaModel
getLineNumber
-
-
-
-
Field Detail
-
classLibrary
private ClassLibrary classLibrary
-
name
private java.lang.String name
-
classes
private java.util.List<JavaClass> classes
-
-
Method Detail
-
getName
public java.lang.String getName()
Equivalent ofPackage.getName()- Specified by:
getNamein interfaceJavaPackage- Returns:
- the name, should never be
null
-
setName
public void setName(java.lang.String name)
-
getCodeBlock
public java.lang.String getCodeBlock()
- Specified by:
getCodeBlockin interfaceJavaModel- Returns:
- the codeblock
-
setClassLibrary
public void setClassLibrary(ClassLibrary classLibrary)
-
getJavaClassLibrary
public ClassLibrary getJavaClassLibrary()
TheClassLibraryof this package.- Specified by:
getJavaClassLibraryin interfaceJavaPackage- Returns:
- the classLibrary, should never be
null
-
addClass
public void addClass(JavaClass clazz)
-
getClasses
public java.util.Collection<JavaClass> getClasses()
Returns all the classes found for the package.- Specified by:
getClassesin interfaceJavaPackage- 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:
getClassByNamein interfaceJavaPackage- 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 ofjava.lang.reflectisjava.lang- Specified by:
getParentPackagein interfaceJavaPackage- Returns:
- the parent package, otherwise
null
-
getSubPackages
public java.util.List<JavaPackage> getSubPackages()
For instance: one of the children ofjava.langwould bejava.lang.reflect- Specified by:
getSubPackagesin interfaceJavaPackage- Returns:
- all the children of this package , never
null
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Description copied from interface:JavaPackageEquivalent ofPackage.toString()- Specified by:
toStringin interfaceJavaPackage- Overrides:
toStringin classjava.lang.Object- Returns:
- the string representation of the package.
-
-