Klasse TypeNode
java.lang.Object
de.svws_nrw.transpiler.typescript.TypeNode
This class is used to handle java type information and transpiles it.
-
Konstruktorübersicht
KonstruktorBeschreibungTypeNode
(TranspilerTypeScriptPlugin plugin, Tree node, boolean decl, boolean notNull) Creates a new variable with transpiled variable information.TypeNode
(TranspilerTypeScriptPlugin plugin, TypeMirror typeMirror, boolean decl, boolean notNull, Map<String, TypeMirror> resolved) Creates a new variable with transpiled variable information. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibunggetArrayContentType
(Transpiler transpiler) Returns a type node for the array content typegetInstanceOf
(String obj) Returns the transpiled code for checking whether the specified object is an instance of this type.Returns a copy of this type without the flag that indicates that this type is used during declarationgetParameterType
(int i, boolean decl) Returns the type of the i-th type parameter.getTypeCast
(String identifier) Returns transpiled code for casting the specified identifier to this type.getTypeCheck
(String identifier) Returns transpiled code to check whether the specified identifier matches this type.boolean
Returns whether the type is a Java array typeboolean
Returns whether the type is java.lang.Boolean.boolean
Returns whether the type is a Java collection type (e.g. java.util.ArrayList).boolean
Returns whether this type node has a not null annotation or not.boolean
Returns whether the type is a number class type (e.g. java.lang.Long).boolean
Returns whether this type is a primitive type or notboolean
Returns whether this type is a primitive boolean type or notboolean
Returns whether this type is a primitive char type or notboolean
Returns whether this type is a primitive floating point number type or notboolean
Returns whether this type is a primitive integer type or notboolean
isString()
Returns whether the type is java.lang.String.void
Sets the internal flag that this type is used as a type for variable arguments.transpile
(boolean noTypeArgs) Returns the transpiled code of this node.transpile
(boolean noTypeArgs, boolean noBounds) Returns the transpiled code of this node.Returns the transpiled code for the type parameters of this node
-
Konstruktordetails
-
TypeNode
Creates a new variable with transpiled variable information.- Parameter:
plugin
- theTranspilerTypeScriptPlugin
usednode
- theTree
object of the java compilerdecl
- specifies whether the type is used during type declarationnotNull
- true if the declaration has a not null annotation
-
TypeNode
public TypeNode(TranspilerTypeScriptPlugin plugin, TypeMirror typeMirror, boolean decl, boolean notNull, Map<String, TypeMirror> resolved) Creates a new variable with transpiled variable information.- Parameter:
plugin
- theTranspilerTypeScriptPlugin
usedtypeMirror
- theTypeMirror
object of the java compilerdecl
- specifies whether the type is used during type declarationnotNull
- true if the declaration has a not null annotationresolved
- a map with a mapping from a type variable to its resolved type
-
-
Methodendetails
-
getNoDeclarationType
Returns a copy of this type without the flag that indicates that this type is used during declaration- Gibt zurück:
- a copy of this type without the flag that indicates that this type is used during declaration
-
setIsVarArg
public void setIsVarArg()Sets the internal flag that this type is used as a type for variable arguments. -
isNotNull
public boolean isNotNull()Returns whether this type node has a not null annotation or not.- Gibt zurück:
- true if the node has a not null annotation or not.
-
isPrimitive
public boolean isPrimitive()Returns whether this type is a primitive type or not- Gibt zurück:
- true if this is a primitive type
-
isPrimitveInteger
public boolean isPrimitveInteger()Returns whether this type is a primitive integer type or not- Gibt zurück:
- true if this is a primitive integer type
-
isPrimitveFloat
public boolean isPrimitveFloat()Returns whether this type is a primitive floating point number type or not- Gibt zurück:
- true if this is a primitive floating point number type
-
isPrimitveBoolean
public boolean isPrimitveBoolean()Returns whether this type is a primitive boolean type or not- Gibt zurück:
- true if this is a primitive boolean type
-
isPrimitveChar
public boolean isPrimitveChar()Returns whether this type is a primitive char type or not- Gibt zurück:
- true if this is a primitive char type
-
isString
public boolean isString()Returns whether the type is java.lang.String.- Gibt zurück:
- true if the type is java.lang.String
-
isBoolean
public boolean isBoolean()Returns whether the type is java.lang.Boolean.- Gibt zurück:
- true if the type is java.lang.Boolean
-
isNumberClass
public boolean isNumberClass()Returns whether the type is a number class type (e.g. java.lang.Long).- Gibt zurück:
- true if the type is a number class type
-
isCollectionType
public boolean isCollectionType()Returns whether the type is a Java collection type (e.g. java.util.ArrayList).- Gibt zurück:
- true if the type is a Java collection type
-
getParameterType
Returns the type of the i-th type parameter.- Parameter:
i
- the number of the type parameterdecl
- specifies whether the type is used during type declaration- Gibt zurück:
- the type of the i-th type parameter or null if this type no parameterized type or i is invalid
-
isArrayType
public boolean isArrayType()Returns whether the type is a Java array type- Gibt zurück:
- true if the type is a Java array type
-
getArrayContentType
Returns a type node for the array content type- Parameter:
transpiler
- the transpiler used for checking the annotation- Gibt zurück:
- the type node for the array content type
-
transpileTypeParametersOnly
Returns the transpiled code for the type parameters of this node- Gibt zurück:
- the transpiled code
-
transpile
Returns the transpiled code of this node.- Parameter:
noTypeArgs
- if set to true the type arguments of parameterized types are not transpiled. This feature is used e.g. for the instanceof operator.- Gibt zurück:
- the transpiled code
-
transpile
Returns the transpiled code of this node.- Parameter:
noTypeArgs
- if set to true the type arguments of parameterized types are not transpiled. This feature is used e.g. for the instanceof operator.noBounds
- if set to true the bounds for type arguments of parameterized types are not transpiled- Gibt zurück:
- the transpiled code
-
getInstanceOf
Returns the transpiled code for checking whether the specified object is an instance of this type.- Parameter:
obj
- the object to be checked- Gibt zurück:
- the transpiled instanceof code
-
getTypeCheck
Returns transpiled code to check whether the specified identifier matches this type.- Parameter:
identifier
- the identifier to be checked- Gibt zurück:
- the type check code
-
getTypeCast
Returns transpiled code for casting the specified identifier to this type. Casting is only used for Java object types.- Parameter:
identifier
- the identifier- Gibt zurück:
- the transpiled code
-