Class JavaMethodBindingEmitter

java.lang.Object
com.jogamp.gluegen.FunctionEmitter
com.jogamp.gluegen.JavaMethodBindingEmitter
Direct Known Subclasses:
ProcAddressJavaMethodBindingEmitter

public class JavaMethodBindingEmitter extends FunctionEmitter
An emitter that emits only the interface for a Java<->C JNI binding.
  • Field Details

  • Constructor Details

    • JavaMethodBindingEmitter

      public JavaMethodBindingEmitter(MethodBinding binding, PrintWriter output, 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 Details

    • getBinding

      public final MethodBinding getBinding()
    • isNativeMethod

      public boolean isNativeMethod()
    • isPrivateNativeMethod

      public boolean isPrivateNativeMethod()
    • isForDirectBufferImplementation

      public boolean isForDirectBufferImplementation()
    • isForIndirectBufferAndArrayImplementation

      public boolean isForIndirectBufferAndArrayImplementation()
    • getInterfaceName

      public String getInterfaceName()
      Specified by:
      getInterfaceName in class FunctionEmitter
    • getImplName

      public String getImplName()
      Specified by:
      getImplName in class FunctionEmitter
    • getNativeName

      public String getNativeName()
      Specified by:
      getNativeName in class FunctionEmitter
    • getCSymbol

      public FunctionSymbol getCSymbol()
      Specified by:
      getCSymbol in class FunctionEmitter
    • getArgumentName

      protected String getArgumentName(int i)
    • getRuntimeExceptionType

      public String getRuntimeExceptionType()
      The type of exception (must subclass java.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.
    • emitReturnType

      protected void emitReturnType(PrintWriter writer)
      Specified by:
      emitReturnType in class FunctionEmitter
    • erasedTypeString

      protected String erasedTypeString(JavaType type, boolean skipBuffers)
    • getReturnTypeString

      protected String getReturnTypeString(boolean skipArray)
    • emitName

      protected void emitName(PrintWriter writer)
      Specified by:
      emitName in class FunctionEmitter
    • emitArguments

      protected int emitArguments(PrintWriter writer)
      Description copied from class: FunctionEmitter
      Returns the number of arguments emitted.
      Specified by:
      emitArguments in class FunctionEmitter
    • getNativeImplMethodName

      protected String getNativeImplMethodName()
    • byteOffsetArgName

      protected String byteOffsetArgName(int i)
    • byteOffsetArgName

      protected static String byteOffsetArgName(String s)
    • isNIOArgName

      protected String isNIOArgName(int i)
    • isNIOArgName

      protected String isNIOArgName(String s)
    • byteOffsetArrayArgName

      protected String byteOffsetArrayArgName(int i)
    • offsetArgName

      protected String offsetArgName(int i)
    • emitBody

      protected void emitBody(PrintWriter writer)
      Specified by:
      emitBody in class FunctionEmitter
    • emitPrologueOrEpilogue

      protected void emitPrologueOrEpilogue(List<String> code, PrintWriter writer)
    • emitPreCallSetup

      protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer)
    • emitArrayLengthAndNIOBufferChecks

      protected void emitArrayLengthAndNIOBufferChecks(MethodBinding binding, PrintWriter writer)
    • emitCompoundArrayCopies

      protected void emitCompoundArrayCopies(MethodBinding binding, PrintWriter writer)
    • emitCall

      protected void emitCall(MethodBinding binding, PrintWriter writer)
    • emitReturnVariableSetupAndCall

      protected void emitReturnVariableSetupAndCall(MethodBinding binding, PrintWriter writer)
    • emitCallArguments

      protected int emitCallArguments(MethodBinding binding, PrintWriter writer)
    • emitPostCallCleanup

      protected void emitPostCallCleanup(MethodBinding binding, PrintWriter writer)
    • emitCallResultReturn

      protected void emitCallResultReturn(MethodBinding binding, PrintWriter writer)
    • argumentNameArray

      protected String[] argumentNameArray()
    • javaThisArgumentName

      public static String javaThisArgumentName()
    • getCommentStartString

      protected String getCommentStartString()
      Overrides:
      getCommentStartString in class FunctionEmitter
    • getCommentEndString

      protected String getCommentEndString()
      Overrides:
      getCommentEndString in class FunctionEmitter
    • getBaseIndentString

      protected String getBaseIndentString()
      Overrides:
      getBaseIndentString in class FunctionEmitter