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>
,java.lang.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.
-
-
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 Modifier and Type Field Description private NodeList<AnnotationExpr>
annotations
-
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, getDataKeys, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getSymbolResolver, getTokenRange, getToStringPrettyPrinterConfiguration, hashCode, isAncestorOf, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeData, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, setToStringPrettyPrinterConfiguration, 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, isDescendantOf
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithRange
containsWithin, containsWithinRange, getBegin, getEnd
-
-
-
-
Field Detail
-
annotations
private NodeList<AnnotationExpr> annotations
-
-
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 java.lang.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()
-
ifArrayType
public void ifArrayType(java.util.function.Consumer<ArrayType> action)
-
ifClassOrInterfaceType
public void ifClassOrInterfaceType(java.util.function.Consumer<ClassOrInterfaceType> action)
-
ifIntersectionType
public void ifIntersectionType(java.util.function.Consumer<IntersectionType> action)
-
ifPrimitiveType
public void ifPrimitiveType(java.util.function.Consumer<PrimitiveType> action)
-
ifReferenceType
public void ifReferenceType(java.util.function.Consumer<ReferenceType> action)
-
ifTypeParameter
public void ifTypeParameter(java.util.function.Consumer<TypeParameter> action)
-
ifUnionType
public void ifUnionType(java.util.function.Consumer<UnionType> action)
-
ifUnknownType
public void ifUnknownType(java.util.function.Consumer<UnknownType> action)
-
ifVoidType
public void ifVoidType(java.util.function.Consumer<VoidType> action)
-
ifWildcardType
public void ifWildcardType(java.util.function.Consumer<WildcardType> action)
-
resolve
public abstract ResolvedType resolve()
- Specified by:
resolve
in interfaceResolvable<ResolvedType>
-
toArrayType
public java.util.Optional<ArrayType> toArrayType()
-
toClassOrInterfaceType
public java.util.Optional<ClassOrInterfaceType> toClassOrInterfaceType()
-
toIntersectionType
public java.util.Optional<IntersectionType> toIntersectionType()
-
toPrimitiveType
public java.util.Optional<PrimitiveType> toPrimitiveType()
-
toReferenceType
public java.util.Optional<ReferenceType> toReferenceType()
-
toTypeParameter
public java.util.Optional<TypeParameter> toTypeParameter()
-
toUnionType
public java.util.Optional<UnionType> toUnionType()
-
toUnknownType
public java.util.Optional<UnknownType> toUnknownType()
-
toVoidType
public java.util.Optional<VoidType> toVoidType()
-
toWildcardType
public java.util.Optional<WildcardType> toWildcardType()
-
isVarType
public boolean isVarType()
-
asVarType
public VarType asVarType()
-
toVarType
public java.util.Optional<VarType> toVarType()
-
ifVarType
public void ifVarType(java.util.function.Consumer<VarType> action)
-
-