public final class CompilationUnitImpl extends Object implements CompilationUnit
CompilationUnit
.Constructor and Description |
---|
CompilationUnitImpl() |
Modifier and Type | Method and Description |
---|---|
<R,C,E extends Throwable> |
accept(Visitor<R,C,E> visitor,
C context)
Accepts the
Visitor and processes this object in the visitor. |
boolean |
equals(Object obj)
Returns whether this object is equivalent to the specified object or not.
|
<T> T |
findModelTrait(Class<T> traitClass)
Returns a model trait for the specified type.
|
List<? extends Comment> |
getComments()
Returns the comments.
|
List<? extends ImportDeclaration> |
getImportDeclarations()
Returns the import declarations.
|
ModelKind |
getModelKind()
Returns
ModelKind.COMPILATION_UNIT which represents this element kind. |
PackageDeclaration |
getPackageDeclaration()
Returns the package declaration.
|
List<? extends TypeDeclaration> |
getTypeDeclarations()
Returns the type declarations.
|
int |
hashCode()
Returns the hash code of this model object.
|
<T> void |
putModelTrait(Class<T> traitClass,
T traitObject)
Puts a model trait.
|
void |
setComments(List<? extends Comment> comments)
Sets the comments.
|
void |
setImportDeclarations(List<? extends ImportDeclaration> importDeclarations)
Sets the import declarations.
|
void |
setPackageDeclaration(PackageDeclaration packageDeclaration)
Sets the package declaration.
|
void |
setTypeDeclarations(List<? extends TypeDeclaration> typeDeclarations)
Sets the type declarations.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
equals, findModelTrait, hashCode, putModelTrait
public PackageDeclaration getPackageDeclaration()
CompilationUnit
getPackageDeclaration
in interface CompilationUnit
null
if the compilation unit is on the default packagepublic void setPackageDeclaration(PackageDeclaration packageDeclaration)
packageDeclaration
- the package declaration, or null
for the default packagepublic List<? extends ImportDeclaration> getImportDeclarations()
CompilationUnit
getImportDeclarations
in interface CompilationUnit
public void setImportDeclarations(List<? extends ImportDeclaration> importDeclarations)
importDeclarations
- the import declarationsIllegalArgumentException
- if importDeclarations
was null
public List<? extends TypeDeclaration> getTypeDeclarations()
CompilationUnit
getTypeDeclarations
in interface CompilationUnit
public void setTypeDeclarations(List<? extends TypeDeclaration> typeDeclarations)
typeDeclarations
- the type declarationsIllegalArgumentException
- if typeDeclarations
was null
public List<? extends Comment> getComments()
CompilationUnit
getComments
in interface CompilationUnit
public void setComments(List<? extends Comment> comments)
comments
- the commentsIllegalArgumentException
- if comments
was null
public ModelKind getModelKind()
ModelKind.COMPILATION_UNIT
which represents this element kind.getModelKind
in interface Model
ModelKind.COMPILATION_UNIT
public <R,C,E extends Throwable> R accept(Visitor<R,C,E> visitor, C context) throws E extends Throwable
Model
Visitor
and processes this object in the visitor.accept
in interface Model
R
- type of visitor resultC
- type of visitor contextE
- type of visitor exceptionvisitor
- the target visitorcontext
- the current context (nullable)E
- if error occurred while processing this object in the visitorE extends Throwable
public <T> T findModelTrait(Class<T> traitClass)
Model
findModelTrait
in interface Model
T
- the trait typetraitClass
- the trait typenull
if there is no such a traitpublic <T> void putModelTrait(Class<T> traitClass, T traitObject)
Model
putModelTrait
in interface Model
T
- the trait typetraitClass
- the trait typetraitObject
- the trait object, or null
to remove the target traitpublic int hashCode()
Model
traits
does not have any effects to the hash code.public boolean equals(Object obj)
Model
traits
does not have any effects to the equivalence.Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.