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
-
-
Constructor Summary
Constructors Constructor Description DefaultJavaPackage(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClass(JavaClass clazz)
boolean
equals(java.lang.Object o)
JavaClass
getClassByName(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.String
getCodeBlock()
ClassLibrary
getJavaClassLibrary()
TheClassLibrary
of this package.java.lang.String
getName()
Equivalent ofPackage.getName()
JavaPackage
getParentPackage()
The parent of this package For instance: the package ofjava.lang.reflect
isjava.lang
java.util.List<JavaPackage>
getSubPackages()
For instance: one of the children ofjava.lang
would bejava.lang.reflect
int
hashCode()
void
setClassLibrary(ClassLibrary classLibrary)
void
setName(java.lang.String name)
java.lang.String
toString()
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
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Equivalent ofPackage.getName()
- Specified by:
getName
in interfaceJavaPackage
- 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 interfaceJavaModel
- Returns:
- the codeblock
-
setClassLibrary
public void setClassLibrary(ClassLibrary classLibrary)
-
getJavaClassLibrary
public ClassLibrary getJavaClassLibrary()
TheClassLibrary
of this package.- Specified by:
getJavaClassLibrary
in 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:
getClasses
in 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:
getClassByName
in 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.reflect
isjava.lang
- Specified by:
getParentPackage
in interfaceJavaPackage
- Returns:
- the parent package, otherwise
null
-
getSubPackages
public java.util.List<JavaPackage> getSubPackages()
For instance: one of the children ofjava.lang
would bejava.lang.reflect
- Specified by:
getSubPackages
in interfaceJavaPackage
- Returns:
- all the children of this package , never
null
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
Description copied from interface:JavaPackage
Equivalent ofPackage.toString()
- Specified by:
toString
in interfaceJavaPackage
- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation of the package.
-
-