Top Description Inners Fields Constructors Methods
com.jogamp.gluegen

public Class JavaType

extends Object
Class Inheritance
Imports
java.nio.*, com.jogamp.gluegen.cgram.types.*

Describes a java-side representation of a type that is used to represent the same data on both the Java-side and C-side during a JNI operation. Also contains some utility methods for creating common types.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private final Class<?>
private final Type
private static JavaType
private static JavaType
private static JavaType
private static JavaType
private static JavaType
private static JavaType
private static JavaType
private static JavaType
private static JavaType
private final boolean
private final JavaType.C_PTR
private final String

Constructor Summary

AccessConstructor and Description
private
JavaType(final Class<?> clazz, final boolean opaqued)

Constructs a representation for a type corresponding to the given Class argument.

private
JavaType(final String structName)

Constructs a type representing a named C struct.

private
JavaType(final JavaType.C_PTR primitivePointerType)

Constructs a type representing a pointer to a C primitive (integer, floating-point, or void pointer) type.

private
JavaType(final Type elementType)

Constructs a type representing an array of C pointers.

private
JavaType(final JavaType.C_PTR primitivePointerType, final Class<?> clazz, final String name, final Type elementType)

clone only

Method Summary

Modifier and TypeMethod and Description
private void
append(final StringBuilder sb, final String val, final boolean prepComma)

private String
private String
arrayName(Class<?> clazz)

public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public static JavaType
createForCArray(final Type elementType)

Creates a JavaType corresponding to an array of the given element type.

public static JavaType
public static JavaType
public static JavaType
public static JavaType
public static JavaType
public static JavaType
createForClass(final Class<?> clazz)

Creates a JavaType corresponding to the given Java type.

public static JavaType
public static JavaType
createForCStruct(final String name)

Creates a JavaType corresponding to the specified C CompoundType name; for example, if "Foo" is supplied, then this JavaType represents a "Foo *" by way of a StructAccessor.

public static JavaType
public static JavaType
public static JavaType
createForOpaqueClass(final Class<?> clazz)

Creates a JavaType corresponding to the given opaque Java type.

private String
descriptor(final Class<?> clazz)

private String
descriptor(final String referenceTypeName)

public boolean
equals(final Object
the reference object with which to compare.
arg
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public static JavaType
public static JavaType
public static JavaType
public static JavaType
public static JavaType
public static JavaType
public static JavaType
public static JavaType
public static JavaType
public String
public String
getDescriptor()

Returns the descriptor (internal type signature) corresponding to this type.

public Type
public JavaType
public Class<?>
getJavaClass()

Returns the Java Class corresponding to this type.

public String
getName()

Returns the Java type name corresponding to this type.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public String
jniTypeName()

Returns the String corresponding to the JNI type for this type, or NULL if it can't be represented (i.e., it's a boxing class that we need to call getBuffer() on.)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

clazzback to summary
private final Class<?> clazz
elementTypeback to summary
private final Type elementType
nioBufferTypeback to summary
private static JavaType nioBufferType
nioByteBufferArrayTypeback to summary
private static JavaType nioByteBufferArrayType
nioByteBufferTypeback to summary
private static JavaType nioByteBufferType
nioDoubleBufferTypeback to summary
private static JavaType nioDoubleBufferType
nioFloatBufferTypeback to summary
private static JavaType nioFloatBufferType
nioIntBufferTypeback to summary
private static JavaType nioIntBufferType
nioLongBufferTypeback to summary
private static JavaType nioLongBufferType
nioPointerBufferTypeback to summary
private static JavaType nioPointerBufferType
nioShortBufferTypeback to summary
private static JavaType nioShortBufferType
opaquedback to summary
private final boolean opaqued
primitivePointerTypeback to summary
private final JavaType.C_PTR primitivePointerType
structNameback to summary
private final String structName

Constructor Detail

JavaTypeback to summary
private JavaType(final Class<?> clazz, final boolean opaqued)

Constructs a representation for a type corresponding to the given Class argument.

JavaTypeback to summary
private JavaType(final String structName)

Constructs a type representing a named C struct.

JavaTypeback to summary
private JavaType(final JavaType.C_PTR primitivePointerType)

Constructs a type representing a pointer to a C primitive (integer, floating-point, or void pointer) type.

JavaTypeback to summary
private JavaType(final Type elementType)

Constructs a type representing an array of C pointers.

JavaTypeback to summary
private JavaType(final JavaType.C_PTR primitivePointerType, final Class<?> clazz, final String name, final Type elementType)

clone only

Method Detail

appendback to summary
private void append(final StringBuilder sb, final String val, final boolean prepComma)
arrayDescriptorback to summary
private String arrayDescriptor(Class<?> clazz)
arrayNameback to summary
private String arrayName(Class<?> clazz)
cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

Annotations
@Override
createForCArrayback to summary
public static JavaType createForCArray(final Type elementType)

Creates a JavaType corresponding to an array of the given element type. This is used to represent arrays of "Foo **" which should be mapped to Foo[] in Java.

createForCCharPointerback to summary
public static JavaType createForCCharPointer()
createForCDoublePointerback to summary
public static JavaType createForCDoublePointer()
createForCFloatPointerback to summary
public static JavaType createForCFloatPointer()
createForCInt32Pointerback to summary
public static JavaType createForCInt32Pointer()
createForCInt64Pointerback to summary
public static JavaType createForCInt64Pointer()
createForClassback to summary
public static JavaType createForClass(final Class<?> clazz)

Creates a JavaType corresponding to the given Java type. This can be used to represent arrays of primitive values or Strings; the emitters understand how to perform proper conversion from the corresponding C type.

createForCShortPointerback to summary
public static JavaType createForCShortPointer()
createForCStructback to summary
public static JavaType createForCStruct(final String name)

Creates a JavaType corresponding to the specified C CompoundType name; for example, if "Foo" is supplied, then this JavaType represents a "Foo *" by way of a StructAccessor.

createForCVoidPointerback to summary
public static JavaType createForCVoidPointer()
createForJNIEnvback to summary
public static JavaType createForJNIEnv()
createForOpaqueClassback to summary
public static JavaType createForOpaqueClass(final Class<?> clazz)

Creates a JavaType corresponding to the given opaque Java type. This can be used to represent arrays of primitive values or Strings; the emitters understand how to perform proper conversion from the corresponding C type.

descriptorback to summary
private String descriptor(final Class<?> clazz)
descriptorback to summary
private String descriptor(final String referenceTypeName)
equalsback to summary
public boolean equals(final Object arg)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
arg:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
forNIOBufferClassback to summary
public static JavaType forNIOBufferClass()
forNIOByteBufferArrayClassback to summary
public static JavaType forNIOByteBufferArrayClass()
forNIOByteBufferClassback to summary
public static JavaType forNIOByteBufferClass()
forNIODoubleBufferClassback to summary
public static JavaType forNIODoubleBufferClass()
forNIOFloatBufferClassback to summary
public static JavaType forNIOFloatBufferClass()
forNIOIntBufferClassback to summary
public static JavaType forNIOIntBufferClass()
forNIOLongBufferClassback to summary
public static JavaType forNIOLongBufferClass()
forNIOPointerBufferClassback to summary
public static JavaType forNIOPointerBufferClass()
forNIOShortBufferClassback to summary
public static JavaType forNIOShortBufferClass()
getDebugStringback to summary
public String getDebugString()
getDescriptorback to summary
public String getDescriptor()

Returns the descriptor (internal type signature) corresponding to this type.

getElementCTypeback to summary
public Type getElementCType()
getElementTypeback to summary
public JavaType getElementType()
getJavaClassback to summary
public Class<?> getJavaClass()

Returns the Java Class corresponding to this type. Returns null if this object corresponds to a C primitive array type.

getNameback to summary
public String getName()

Returns the Java type name corresponding to this type.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isArrayback to summary
public boolean isArray()
isArrayOfCompoundTypeWrappersback to summary
public boolean isArrayOfCompoundTypeWrappers()
isByteback to summary
public boolean isByte()
isByteArrayback to summary
public boolean isByteArray()
isCCharPointerTypeback to summary
public boolean isCCharPointerType()
isCDoublePointerTypeback to summary
public boolean isCDoublePointerType()
isCFloatPointerTypeback to summary
public boolean isCFloatPointerType()
isCInt32PointerTypeback to summary
public boolean isCInt32PointerType()
isCInt64PointerTypeback to summary
public boolean isCInt64PointerType()
isCompoundTypeWrapperback to summary
public boolean isCompoundTypeWrapper()
isCPrimitivePointerTypeback to summary
public boolean isCPrimitivePointerType()
isCShortPointerTypeback to summary
public boolean isCShortPointerType()
isCVoidPointerTypeback to summary
public boolean isCVoidPointerType()
isDoubleback to summary
public boolean isDouble()
isDoubleArrayback to summary
public boolean isDoubleArray()
isFloatback to summary
public boolean isFloat()
isFloatArrayback to summary
public boolean isFloatArray()
isIntback to summary
public boolean isInt()
isIntArrayback to summary
public boolean isIntArray()
isJNIEnvback to summary
public boolean isJNIEnv()
isLongback to summary
public boolean isLong()
isLongArrayback to summary
public boolean isLongArray()
isNIOBufferback to summary
public boolean isNIOBuffer()
isNIOBufferArrayback to summary
public boolean isNIOBufferArray()
isNIOByteBufferback to summary
public boolean isNIOByteBuffer()
isNIOByteBufferArrayback to summary
public boolean isNIOByteBufferArray()
isNIOLongBufferback to summary
public boolean isNIOLongBuffer()
isNIOPointerBufferback to summary
public boolean isNIOPointerBuffer()
isOpaquedback to summary
public boolean isOpaqued()
isPrimitiveback to summary
public boolean isPrimitive()
isPrimitiveArrayback to summary
public boolean isPrimitiveArray()
isShortback to summary
public boolean isShort()
isShortArrayback to summary
public boolean isShortArray()
isStringback to summary
public boolean isString()
isStringArrayback to summary
public boolean isStringArray()
isVoidback to summary
public boolean isVoid()
jniTypeNameback to summary
public String jniTypeName()

Returns the String corresponding to the JNI type for this type, or NULL if it can't be represented (i.e., it's a boxing class that we need to call getBuffer() on.)

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
com.jogamp.gluegen back to summary

private final Enum JavaType.C_PTR

extends Enum<JavaType.C_PTR>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final JavaType.C_PTR
public static final JavaType.C_PTR
public static final JavaType.C_PTR
public static final JavaType.C_PTR
public static final JavaType.C_PTR
public static final JavaType.C_PTR
public static final JavaType.C_PTR

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static JavaType.C_PTR
public static JavaType.C_PTR[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CHARback to summary
public static final JavaType.C_PTR CHAR
DOUBLEback to summary
public static final JavaType.C_PTR DOUBLE
FLOATback to summary
public static final JavaType.C_PTR FLOAT
INT32back to summary
public static final JavaType.C_PTR INT32
INT64back to summary
public static final JavaType.C_PTR INT64
SHORTback to summary
public static final JavaType.C_PTR SHORT
VOIDback to summary
public static final JavaType.C_PTR VOID

Constructor Detail

C_PTRback to summary
private C_PTR()

Method Detail

valueOfback to summary
public static JavaType.C_PTR valueOf(String name)
valuesback to summary
public static JavaType.C_PTR[] values()