net.java.games.gluegen

Class JavaType


public class JavaType
extends java.lang.Object

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.

Method Summary

Object
clone()
static JavaType
createForCArray(net.java.games.gluegen.cgram.types.Type elementType)
Creates a JavaType corresponding to an array of the given element type.
static JavaType
createForCCharPointer()
static JavaType
createForCDoublePointer()
static JavaType
createForCFloatPointer()
static JavaType
createForCInt32Pointer()
static JavaType
createForCInt64Pointer()
static JavaType
createForCShortPointer()
static JavaType
createForCStruct(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.
static JavaType
createForClass(Class clazz)
Creates a JavaType corresponding to the given Java type.
static JavaType
createForJNIEnv()
static JavaType
createForVoidPointer()
boolean
equals(Object arg)
static JavaType
forNIOBufferClass()
static JavaType
forNIOByteBufferArrayClass()
static JavaType
forNIOByteBufferClass()
static JavaType
forNIODoubleBufferClass()
static JavaType
forNIOFloatBufferClass()
static JavaType
forNIOIntBufferClass()
static JavaType
forNIOLongBufferClass()
static JavaType
forNIOShortBufferClass()
Class
getJavaClass()
Returns the Java Class corresponding to this type.
String
getName()
Returns the name corresponding to this type.
int
hashCode()
boolean
isArray()
boolean
isArrayOfCompoundTypeWrappers()
boolean
isCCharPointerType()
boolean
isCDoublePointerType()
boolean
isCFloatPointerType()
boolean
isCInt32PointerType()
boolean
isCInt64PointerType()
boolean
isCPrimitivePointerType()
boolean
isCShortPointerType()
boolean
isCVoidPointerType()
boolean
isCompoundTypeWrapper()
boolean
isJNIEnv()
boolean
isNIOBuffer()
boolean
isNIOBufferArray()
boolean
isNIOByteBuffer()
boolean
isNIOByteBufferArray()
boolean
isPrimitive()
boolean
isPrimitiveArray()
boolean
isString()
boolean
isVoid()
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.)
String
toString()

Method Details

clone

public Object clone()

createForCArray

public static JavaType createForCArray(net.java.games.gluegen.cgram.types.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.

createForCCharPointer

public static JavaType createForCCharPointer()

createForCDoublePointer

public static JavaType createForCDoublePointer()

createForCFloatPointer

public static JavaType createForCFloatPointer()

createForCInt32Pointer

public static JavaType createForCInt32Pointer()

createForCInt64Pointer

public static JavaType createForCInt64Pointer()

createForCShortPointer

public static JavaType createForCShortPointer()

createForCStruct

public static JavaType createForCStruct(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.

createForClass

public static JavaType createForClass(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.

createForJNIEnv

public static JavaType createForJNIEnv()

createForVoidPointer

public static JavaType createForVoidPointer()

equals

public boolean equals(Object arg)

forNIOBufferClass

public static JavaType forNIOBufferClass()

forNIOByteBufferArrayClass

public static JavaType forNIOByteBufferArrayClass()

forNIOByteBufferClass

public static JavaType forNIOByteBufferClass()

forNIODoubleBufferClass

public static JavaType forNIODoubleBufferClass()

forNIOFloatBufferClass

public static JavaType forNIOFloatBufferClass()

forNIOIntBufferClass

public static JavaType forNIOIntBufferClass()

forNIOLongBufferClass

public static JavaType forNIOLongBufferClass()

forNIOShortBufferClass

public static JavaType forNIOShortBufferClass()

getJavaClass

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

getName

public String getName()
Returns the name corresponding to this type. Returns null when this object does not represent a C-language "struct" type.

hashCode

public int hashCode()

isArray

public boolean isArray()

isArrayOfCompoundTypeWrappers

public boolean isArrayOfCompoundTypeWrappers()

isCCharPointerType

public boolean isCCharPointerType()

isCDoublePointerType

public boolean isCDoublePointerType()

isCFloatPointerType

public boolean isCFloatPointerType()

isCInt32PointerType

public boolean isCInt32PointerType()

isCInt64PointerType

public boolean isCInt64PointerType()

isCPrimitivePointerType

public boolean isCPrimitivePointerType()

isCShortPointerType

public boolean isCShortPointerType()

isCVoidPointerType

public boolean isCVoidPointerType()

isCompoundTypeWrapper

public boolean isCompoundTypeWrapper()

isJNIEnv

public boolean isJNIEnv()

isNIOBuffer

public boolean isNIOBuffer()

isNIOBufferArray

public boolean isNIOBufferArray()

isNIOByteBuffer

public boolean isNIOByteBuffer()

isNIOByteBufferArray

public boolean isNIOByteBufferArray()

isPrimitive

public boolean isPrimitive()

isPrimitiveArray

public boolean isPrimitiveArray()

isString

public boolean isString()

isVoid

public boolean isVoid()

jniTypeName

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.)

toString

public String toString()