Class ResolvedUnionType
- java.lang.Object
-
- com.github.javaparser.resolution.types.ResolvedUnionType
-
- All Implemented Interfaces:
ResolvedType
public class ResolvedUnionType extends java.lang.Object implements ResolvedType
A union type is defined in java as list of types separates by pipes.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ResolvedType>
elements
-
Constructor Summary
Constructors Constructor Description ResolvedUnionType(java.util.List<ResolvedType> elements)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResolvedUnionType
asUnionType()
java.lang.String
describe()
boolean
equals(java.lang.Object o)
java.util.Optional<ResolvedReferenceType>
getCommonAncestor()
java.util.List<ResolvedType>
getElements()
int
hashCode()
boolean
isAssignableBy(ResolvedType other)
This method checks if ThisType t = new OtherType() would compile.boolean
isUnionType()
Is this a union type (as the ones used in multi catch clauses)?-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.resolution.types.ResolvedType
arrayLevel, asArrayType, asConstraintType, asPrimitive, asReferenceType, asTypeParameter, asTypeVariable, asWildcard, erasure, isArray, isConstraint, isInferenceVariable, isNull, isNumericType, isPrimitive, isReference, isReferenceType, isTypeVariable, isVoid, isWildcard, mention, replaceTypeVariables, replaceTypeVariables, solveGenericTypes, toDescriptor
-
-
-
-
Field Detail
-
elements
private java.util.List<ResolvedType> elements
-
-
Constructor Detail
-
ResolvedUnionType
public ResolvedUnionType(java.util.List<ResolvedType> elements)
-
-
Method Detail
-
getCommonAncestor
public java.util.Optional<ResolvedReferenceType> getCommonAncestor()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
describe
public java.lang.String describe()
- Specified by:
describe
in interfaceResolvedType
-
isAssignableBy
public boolean isAssignableBy(ResolvedType other)
Description copied from interface:ResolvedType
This method checks if ThisType t = new OtherType() would compile.- Specified by:
isAssignableBy
in interfaceResolvedType
-
isUnionType
public boolean isUnionType()
Description copied from interface:ResolvedType
Is this a union type (as the ones used in multi catch clauses)?- Specified by:
isUnionType
in interfaceResolvedType
-
asUnionType
public ResolvedUnionType asUnionType()
- Specified by:
asUnionType
in interfaceResolvedType
-
getElements
public java.util.List<ResolvedType> getElements()
-
-