Package com.jogamp.gluegen
Class JavaMethodBindingEmitter
- java.lang.Object
-
- com.jogamp.gluegen.FunctionEmitter
-
- com.jogamp.gluegen.JavaMethodBindingEmitter
-
- Direct Known Subclasses:
ProcAddressJavaMethodBindingEmitter
public class JavaMethodBindingEmitter extends FunctionEmitter
Emits the Java-side component (interface and.or implementation) of the Java<->C JNI binding to itsCodeUnit, seeFunctionEmitter.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classJavaMethodBindingEmitter.DefaultCommentEmitterClass that emits a generic comment for JavaMethodBindingEmitters; the comment includes the C signature of the native method that is being bound by the emitter java method.protected classJavaMethodBindingEmitter.InterfaceCommentEmitter-
Nested classes/interfaces inherited from class com.jogamp.gluegen.FunctionEmitter
FunctionEmitter.EmissionModifier
-
-
Field Summary
Fields Modifier and Type Field Description static FunctionEmitter.EmissionModifierABSTRACTprotected CommentEmitterdefaultInterfaceCommentEmitterprotected CommentEmitterdefaultJavaCommentEmitterprotected List<String>epiloguestatic FunctionEmitter.EmissionModifierFINALstatic FunctionEmitter.EmissionModifierNATIVEstatic FunctionEmitter.EmissionModifierPRIVATEprotected List<String>prologuestatic FunctionEmitter.EmissionModifierPROTECTEDstatic FunctionEmitter.EmissionModifierPUBLICstatic FunctionEmitter.EmissionModifierSYNCHRONIZEDprotected booleantagNativeBindingprotected booleanuseNIODirectOnly-
Fields inherited from class com.jogamp.gluegen.FunctionEmitter
binding, cfg, STATIC, unit
-
-
Constructor Summary
Constructors Constructor Description JavaMethodBindingEmitter(JavaMethodBindingEmitter arg)JavaMethodBindingEmitter(MethodBinding binding, CodeUnit unit, String runtimeExceptionType, String unsupportedExceptionType, boolean emitBody, boolean tagNativeBinding, boolean eraseBufferAndArrayTypes, boolean useNIOOnly, boolean useNIODirectOnly, boolean forDirectBufferImplementation, boolean forIndirectBufferAndArrayImplementation, boolean isUnimplemented, boolean isInterface, boolean isNativeMethod, boolean isPrivateNativeMethod, JavaConfiguration configuration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intappendArguments(StringBuilder buf)Returns the number of arguments emitted.protected StringBuilderappendName(StringBuilder buf)protected StringBuilderappendReturnType(StringBuilder buf)protected String[]argumentNameArray()protected StringbyteOffsetArgName(int i)protected static StringbyteOffsetArgName(String s)protected StringbyteOffsetArrayArgName(int i)protected voidemitAdditionalCode()protected voidemitArrayLengthAndNIOBufferChecks(MethodBinding binding)protected voidemitBody()protected voidemitCall(MethodBinding binding)protected intemitCallArguments(MethodBinding binding)protected voidemitCallResultReturn(MethodBinding binding)protected voidemitCompoundArrayCopies(MethodBinding binding)protected voidemitPostCallCleanup(MethodBinding binding)protected voidemitPreCallSetup(MethodBinding binding)protected voidemitPrologueOrEpilogue(List<String> code)protected voidemitReturnVariableSetupAndCall(MethodBinding binding)protected StringerasedTypeString(JavaType type, boolean skipBuffers)protected StringgetArgumentName(int i)protected StringgetBaseIndentString()protected StringgetCommentEndString()protected StringgetCommentStartString()FunctionSymbolgetCSymbol()StringgetImplName()StringgetInterfaceName()protected StringgetNativeImplMethodName()StringgetNativeName()protected StringgetReturnedArrayLengthComment()protected StringgetReturnedArrayLengthExpression()protected StringgetReturnTypeString(boolean skipArray)StringgetRuntimeExceptionType()The type of exception (must subclassjava.lang.RuntimeException) raised if runtime checks fail in the generated code.StringgetUnsupportedExceptionType()booleanisForDirectBufferImplementation()booleanisForIndirectBufferAndArrayImplementation()booleanisNativeMethod()protected StringisNIOArgName(int i)protected StringisNIOArgName(String s)booleanisPrivateNativeMethod()static StringjavaThisArgumentName()protected StringoffsetArgName(int i)voidsetEmitBody(boolean emitBody)Accessor for subclasses.voidsetEpilogue(List<String> epilogue)Sets the manually-generated epilogue code for this emitter.voidsetEraseBufferAndArrayTypes(boolean erase)Accessor for subclasses.voidsetForDirectBufferImplementation(boolean direct)Accessor for subclasses.voidsetForIndirectBufferAndArrayImplementation(boolean indirect)Accessor for subclasses.voidsetPrivateNativeMethod(boolean v)Accessor for subclasses.voidsetPrologue(List<String> prologue)Sets the manually-generated prologue code for this emitter.voidsetReturnedArrayLengthExpression(String expr)If the underlying function returns an array (currently only arrays of compound types are supported) as opposed to a pointer to an object, this method should be called to provide a MessageFormat string containing an expression that computes the number of elements of the returned array.protected voidsetReturnedArrayLengthExpression(String expr, boolean onlyForComments)booleansignatureOnly()Indicates whether this emitter will print only a signature, or whether it will emit Java code for the body of the method as well.-
Methods inherited from class com.jogamp.gluegen.FunctionEmitter
addModifier, addModifiers, appendModifiers, appendSignature, clearModifiers, emit, emitArguments, emitDocComment, emitModifiers, emitName, emitReturnType, emitSignature, getBinding, getCommentEmitter, getModifiers, getUnit, hasModifier, isInterface, removeModifier, setCommentEmitter, toString
-
-
-
-
Field Detail
-
PUBLIC
public static final FunctionEmitter.EmissionModifier PUBLIC
-
PROTECTED
public static final FunctionEmitter.EmissionModifier PROTECTED
-
PRIVATE
public static final FunctionEmitter.EmissionModifier PRIVATE
-
ABSTRACT
public static final FunctionEmitter.EmissionModifier ABSTRACT
-
FINAL
public static final FunctionEmitter.EmissionModifier FINAL
-
NATIVE
public static final FunctionEmitter.EmissionModifier NATIVE
-
SYNCHRONIZED
public static final FunctionEmitter.EmissionModifier SYNCHRONIZED
-
defaultJavaCommentEmitter
protected final CommentEmitter defaultJavaCommentEmitter
-
defaultInterfaceCommentEmitter
protected final CommentEmitter defaultInterfaceCommentEmitter
-
tagNativeBinding
protected final boolean tagNativeBinding
-
useNIODirectOnly
protected final boolean useNIODirectOnly
-
-
Constructor Detail
-
JavaMethodBindingEmitter
public JavaMethodBindingEmitter(MethodBinding binding, CodeUnit unit, String runtimeExceptionType, String unsupportedExceptionType, boolean emitBody, boolean tagNativeBinding, boolean eraseBufferAndArrayTypes, boolean useNIOOnly, boolean useNIODirectOnly, boolean forDirectBufferImplementation, boolean forIndirectBufferAndArrayImplementation, boolean isUnimplemented, boolean isInterface, boolean isNativeMethod, boolean isPrivateNativeMethod, JavaConfiguration configuration)
-
JavaMethodBindingEmitter
public JavaMethodBindingEmitter(JavaMethodBindingEmitter arg)
-
-
Method Detail
-
isNativeMethod
public boolean isNativeMethod()
-
isPrivateNativeMethod
public boolean isPrivateNativeMethod()
-
isForDirectBufferImplementation
public boolean isForDirectBufferImplementation()
-
isForIndirectBufferAndArrayImplementation
public boolean isForIndirectBufferAndArrayImplementation()
-
getInterfaceName
public String getInterfaceName()
- Specified by:
getInterfaceNamein classFunctionEmitter
-
getImplName
public String getImplName()
- Specified by:
getImplNamein classFunctionEmitter
-
getNativeName
public String getNativeName()
- Specified by:
getNativeNamein classFunctionEmitter
-
getCSymbol
public FunctionSymbol getCSymbol()
- Specified by:
getCSymbolin classFunctionEmitter
-
getArgumentName
protected String getArgumentName(int i)
-
getRuntimeExceptionType
public String getRuntimeExceptionType()
The type of exception (must subclassjava.lang.RuntimeException) raised if runtime checks fail in the generated code.
-
getUnsupportedExceptionType
public String getUnsupportedExceptionType()
-
setReturnedArrayLengthExpression
public void setReturnedArrayLengthExpression(String expr)
If the underlying function returns an array (currently only arrays of compound types are supported) as opposed to a pointer to an object, this method should be called to provide a MessageFormat string containing an expression that computes the number of elements of the returned array. The parameters to the MessageFormat expression are the names of the incoming Java arguments.
-
setReturnedArrayLengthExpression
protected void setReturnedArrayLengthExpression(String expr, boolean onlyForComments)
-
getReturnedArrayLengthExpression
protected String getReturnedArrayLengthExpression()
-
getReturnedArrayLengthComment
protected String getReturnedArrayLengthComment()
-
setPrologue
public void setPrologue(List<String> prologue)
Sets the manually-generated prologue code for this emitter.
-
setEpilogue
public void setEpilogue(List<String> epilogue)
Sets the manually-generated epilogue code for this emitter.
-
signatureOnly
public boolean signatureOnly()
Indicates whether this emitter will print only a signature, or whether it will emit Java code for the body of the method as well.
-
setEmitBody
public void setEmitBody(boolean emitBody)
Accessor for subclasses.
-
setEraseBufferAndArrayTypes
public void setEraseBufferAndArrayTypes(boolean erase)
Accessor for subclasses.
-
setPrivateNativeMethod
public void setPrivateNativeMethod(boolean v)
Accessor for subclasses.
-
setForDirectBufferImplementation
public void setForDirectBufferImplementation(boolean direct)
Accessor for subclasses.
-
setForIndirectBufferAndArrayImplementation
public void setForIndirectBufferAndArrayImplementation(boolean indirect)
Accessor for subclasses.
-
appendReturnType
protected StringBuilder appendReturnType(StringBuilder buf)
- Specified by:
appendReturnTypein classFunctionEmitter
-
getReturnTypeString
protected String getReturnTypeString(boolean skipArray)
-
appendName
protected StringBuilder appendName(StringBuilder buf)
- Specified by:
appendNamein classFunctionEmitter
-
appendArguments
protected int appendArguments(StringBuilder buf)
Description copied from class:FunctionEmitterReturns the number of arguments emitted.- Specified by:
appendArgumentsin classFunctionEmitter
-
getNativeImplMethodName
protected String getNativeImplMethodName()
-
byteOffsetArgName
protected String byteOffsetArgName(int i)
-
isNIOArgName
protected String isNIOArgName(int i)
-
byteOffsetArrayArgName
protected String byteOffsetArrayArgName(int i)
-
offsetArgName
protected String offsetArgName(int i)
-
emitAdditionalCode
protected void emitAdditionalCode()
- Overrides:
emitAdditionalCodein classFunctionEmitter
-
emitBody
protected void emitBody()
- Specified by:
emitBodyin classFunctionEmitter
-
emitPreCallSetup
protected void emitPreCallSetup(MethodBinding binding)
-
emitArrayLengthAndNIOBufferChecks
protected void emitArrayLengthAndNIOBufferChecks(MethodBinding binding)
-
emitCompoundArrayCopies
protected void emitCompoundArrayCopies(MethodBinding binding)
-
emitCall
protected void emitCall(MethodBinding binding)
-
emitReturnVariableSetupAndCall
protected void emitReturnVariableSetupAndCall(MethodBinding binding)
-
emitCallArguments
protected int emitCallArguments(MethodBinding binding)
-
emitPostCallCleanup
protected void emitPostCallCleanup(MethodBinding binding)
-
emitCallResultReturn
protected void emitCallResultReturn(MethodBinding binding)
-
argumentNameArray
protected String[] argumentNameArray()
-
javaThisArgumentName
public static String javaThisArgumentName()
-
getCommentStartString
protected String getCommentStartString()
- Overrides:
getCommentStartStringin classFunctionEmitter
-
getCommentEndString
protected String getCommentEndString()
- Overrides:
getCommentEndStringin classFunctionEmitter
-
getBaseIndentString
protected String getBaseIndentString()
- Overrides:
getBaseIndentStringin classFunctionEmitter
-
-