Package com.github.javaparser.ast.type
Class Type
- java.lang.Object
-
- com.github.javaparser.ast.Node
-
- com.github.javaparser.ast.type.Type
-
- All Implemented Interfaces:
NodeWithRange<Node>
,NodeWithTokenRange<Node>
,Observable
,Visitable
,HasParentNode<Node>
,Resolvable<ResolvedType>
,Cloneable
- Direct Known Subclasses:
IntersectionType
,PrimitiveType
,ReferenceType
,UnionType
,UnknownType
,VarType
,VoidType
,WildcardType
public abstract class Type extends Node implements Resolvable<ResolvedType>
Base class for types.- Author:
- Julio Vilmar Gesser
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.github.javaparser.ast.Node
Node.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversal
-
-
Field Summary
-
Fields inherited from class com.github.javaparser.ast.Node
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration, SYMBOL_RESOLVER_KEY
-
-
Constructor Summary
Constructors Modifier Constructor Description Type(NodeList<AnnotationExpr> annotations)
protected
Type(TokenRange range)
Several sub classes do not support annotations.Type(TokenRange tokenRange, NodeList<AnnotationExpr> annotations)
This constructor is used by the parser and is considered private.
-
Method Summary
-
Methods inherited from class com.github.javaparser.ast.Node
addOrphanComment, containsData, customInitialization, equals, findAll, findAll, findCompilationUnit, findFirst, findFirst, findFirst, findRootNode, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getSymbolResolver, getTokenRange, hasComment, hashCode, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeData, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, stream, stream, toString, toString, tryAddImportToParentCompilationUnit, unregister, walk, walk, walk
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.HasParentNode
findAncestor, findAncestor, findParent, getAncestorOfType
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithRange
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
-
-
-
-
Constructor Detail
-
Type
protected Type(TokenRange range)
Several sub classes do not support annotations. This is a support constructor for them.
-
Type
public Type(NodeList<AnnotationExpr> annotations)
-
Type
public Type(TokenRange tokenRange, NodeList<AnnotationExpr> annotations)
This constructor is used by the parser and is considered private.
-
-
Method Detail
-
getAnnotations
public NodeList<AnnotationExpr> getAnnotations()
-
getAnnotation
public AnnotationExpr getAnnotation(int i)
-
setAnnotations
public Type setAnnotations(NodeList<AnnotationExpr> annotations)
-
getElementType
public Type getElementType()
Finds the element type, meaning: the type without ArrayTypes around it.In "
int[] a[];
", the element type is int.
-
getArrayLevel
public int getArrayLevel()
-
asString
public abstract String asString()
-
getMetaModel
public TypeMetaModel getMetaModel()
- Overrides:
getMetaModel
in classNode
- Returns:
- get JavaParser specific node introspection information.
-
isArrayType
public boolean isArrayType()
-
asArrayType
public ArrayType asArrayType()
-
isClassOrInterfaceType
public boolean isClassOrInterfaceType()
-
asClassOrInterfaceType
public ClassOrInterfaceType asClassOrInterfaceType()
-
isIntersectionType
public boolean isIntersectionType()
-
asIntersectionType
public IntersectionType asIntersectionType()
-
isPrimitiveType
public boolean isPrimitiveType()
-
asPrimitiveType
public PrimitiveType asPrimitiveType()
-
isReferenceType
public boolean isReferenceType()
-
asReferenceType
public ReferenceType asReferenceType()
-
isTypeParameter
public boolean isTypeParameter()
-
asTypeParameter
public TypeParameter asTypeParameter()
-
isUnionType
public boolean isUnionType()
-
asUnionType
public UnionType asUnionType()
-
isUnknownType
public boolean isUnknownType()
-
asUnknownType
public UnknownType asUnknownType()
-
isVoidType
public boolean isVoidType()
-
asVoidType
public VoidType asVoidType()
-
isWildcardType
public boolean isWildcardType()
-
asWildcardType
public WildcardType asWildcardType()
-
ifClassOrInterfaceType
public void ifClassOrInterfaceType(Consumer<ClassOrInterfaceType> action)
-
ifIntersectionType
public void ifIntersectionType(Consumer<IntersectionType> action)
-
ifPrimitiveType
public void ifPrimitiveType(Consumer<PrimitiveType> action)
-
ifReferenceType
public void ifReferenceType(Consumer<ReferenceType> action)
-
ifTypeParameter
public void ifTypeParameter(Consumer<TypeParameter> action)
-
ifUnknownType
public void ifUnknownType(Consumer<UnknownType> action)
-
ifWildcardType
public void ifWildcardType(Consumer<WildcardType> action)
-
resolve
public abstract ResolvedType resolve()
- Specified by:
resolve
in interfaceResolvable<ResolvedType>
-
toClassOrInterfaceType
public Optional<ClassOrInterfaceType> toClassOrInterfaceType()
-
toIntersectionType
public Optional<IntersectionType> toIntersectionType()
-
toPrimitiveType
public Optional<PrimitiveType> toPrimitiveType()
-
toReferenceType
public Optional<ReferenceType> toReferenceType()
-
toTypeParameter
public Optional<TypeParameter> toTypeParameter()
-
toUnknownType
public Optional<UnknownType> toUnknownType()
-
toWildcardType
public Optional<WildcardType> toWildcardType()
-
isVarType
public boolean isVarType()
-
asVarType
public VarType asVarType()
-
-