public class JavaMethodBindingEmitter extends FunctionEmitter
Modifier and Type | Class and Description |
---|---|
protected class |
JavaMethodBindingEmitter.DefaultCommentEmitter
Class 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 class |
JavaMethodBindingEmitter.InterfaceCommentEmitter |
FunctionEmitter.EmissionModifier
Modifier and Type | Field and Description |
---|---|
static FunctionEmitter.EmissionModifier |
ABSTRACT |
protected MethodBinding |
binding |
protected CommentEmitter |
defaultInterfaceCommentEmitter |
protected CommentEmitter |
defaultJavaCommentEmitter |
protected boolean |
emitBody |
protected List<String> |
epilogue |
protected boolean |
eraseBufferAndArrayTypes |
static FunctionEmitter.EmissionModifier |
FINAL |
protected boolean |
forDirectBufferImplementation |
protected boolean |
forImplementingMethodCall |
protected boolean |
forIndirectBufferAndArrayImplementation |
protected boolean |
isUnimplemented |
static FunctionEmitter.EmissionModifier |
NATIVE |
static FunctionEmitter.EmissionModifier |
PRIVATE |
protected List<String> |
prologue |
static FunctionEmitter.EmissionModifier |
PROTECTED |
static FunctionEmitter.EmissionModifier |
PUBLIC |
static FunctionEmitter.EmissionModifier |
SYNCHRONIZED |
protected boolean |
tagNativeBinding |
protected boolean |
useNIODirectOnly |
protected boolean |
useNIOOnly |
STATIC
Constructor and Description |
---|
JavaMethodBindingEmitter(JavaMethodBindingEmitter arg) |
JavaMethodBindingEmitter(MethodBinding binding,
PrintWriter output,
String runtimeExceptionType,
String unsupportedExceptionType,
boolean emitBody,
boolean tagNativeBinding,
boolean eraseBufferAndArrayTypes,
boolean useNIOOnly,
boolean useNIODirectOnly,
boolean forImplementingMethodCall,
boolean forDirectBufferImplementation,
boolean forIndirectBufferAndArrayImplementation,
boolean isUnimplemented,
boolean isInterface,
JavaConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
protected String[] |
argumentNameArray() |
protected String |
byteOffsetArgName(int i) |
protected String |
byteOffsetArgName(String s) |
protected String |
byteOffsetArrayArgName(int i) |
protected int |
emitArguments(PrintWriter writer)
Returns the number of arguments emitted.
|
protected void |
emitArrayLengthAndNIOBufferChecks(MethodBinding binding,
PrintWriter writer) |
protected void |
emitBody(PrintWriter writer) |
protected void |
emitCall(MethodBinding binding,
PrintWriter writer) |
protected int |
emitCallArguments(MethodBinding binding,
PrintWriter writer) |
protected void |
emitCallResultReturn(MethodBinding binding,
PrintWriter writer) |
protected void |
emitCompoundArrayCopies(MethodBinding binding,
PrintWriter writer) |
protected void |
emitName(PrintWriter writer) |
protected void |
emitPostCallCleanup(MethodBinding binding,
PrintWriter writer) |
protected void |
emitPreCallSetup(MethodBinding binding,
PrintWriter writer) |
protected void |
emitPrologueOrEpilogue(List<String> code,
PrintWriter writer) |
protected void |
emitReturnType(PrintWriter writer) |
protected void |
emitReturnVariableSetupAndCall(MethodBinding binding,
PrintWriter writer) |
protected String |
erasedTypeString(JavaType type,
boolean skipBuffers) |
protected String |
getArgumentName(int i) |
protected String |
getBaseIndentString() |
MethodBinding |
getBinding() |
protected String |
getCommentEndString() |
protected String |
getCommentStartString() |
protected String |
getImplMethodName() |
String |
getName() |
protected String |
getReturnedArrayLengthExpression() |
protected String |
getReturnTypeString(boolean skipArray) |
String |
getRuntimeExceptionType()
The type of exception (must subclass
java.lang.RuntimeException ) raised if runtime
checks fail in the generated code. |
String |
getUnsupportedExceptionType() |
boolean |
isForDirectBufferImplementation() |
boolean |
isForImplementingMethodCall() |
boolean |
isForIndirectBufferAndArrayImplementation() |
protected String |
isNIOArgName(int i) |
protected String |
isNIOArgName(String s) |
static String |
javaThisArgumentName() |
protected String |
offsetArgName(int i) |
void |
setEmitBody(boolean emitBody)
Accessor for subclasses.
|
void |
setEpilogue(List<String> epilogue)
Sets the manually-generated epilogue code for this emitter.
|
void |
setEraseBufferAndArrayTypes(boolean erase)
Accessor for subclasses.
|
void |
setForDirectBufferImplementation(boolean direct)
Accessor for subclasses.
|
void |
setForImplementingMethodCall(boolean impl)
Accessor for subclasses.
|
void |
setForIndirectBufferAndArrayImplementation(boolean indirect)
Accessor for subclasses.
|
void |
setPrologue(List<String> prologue)
Sets the manually-generated prologue code for this emitter.
|
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.
|
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.
|
addModifier, addModifiers, clearModifiers, emit, emit, emitDocComment, emitModifiers, emitSignature, getCommentEmitter, getDefaultOutput, getModifiers, hasModifier, isInterface, removeModifier, setCommentEmitter, toString
public static final FunctionEmitter.EmissionModifier PUBLIC
public static final FunctionEmitter.EmissionModifier PROTECTED
public static final FunctionEmitter.EmissionModifier PRIVATE
public static final FunctionEmitter.EmissionModifier ABSTRACT
public static final FunctionEmitter.EmissionModifier FINAL
public static final FunctionEmitter.EmissionModifier NATIVE
public static final FunctionEmitter.EmissionModifier SYNCHRONIZED
protected final CommentEmitter defaultJavaCommentEmitter
protected final CommentEmitter defaultInterfaceCommentEmitter
protected boolean emitBody
protected boolean eraseBufferAndArrayTypes
protected boolean useNIOOnly
protected boolean useNIODirectOnly
protected boolean forImplementingMethodCall
protected boolean forDirectBufferImplementation
protected boolean forIndirectBufferAndArrayImplementation
protected boolean isUnimplemented
protected boolean tagNativeBinding
protected MethodBinding binding
public JavaMethodBindingEmitter(MethodBinding binding, PrintWriter output, String runtimeExceptionType, String unsupportedExceptionType, boolean emitBody, boolean tagNativeBinding, boolean eraseBufferAndArrayTypes, boolean useNIOOnly, boolean useNIODirectOnly, boolean forImplementingMethodCall, boolean forDirectBufferImplementation, boolean forIndirectBufferAndArrayImplementation, boolean isUnimplemented, boolean isInterface, JavaConfiguration configuration)
public JavaMethodBindingEmitter(JavaMethodBindingEmitter arg)
public final MethodBinding getBinding()
public boolean isForImplementingMethodCall()
public boolean isForDirectBufferImplementation()
public boolean isForIndirectBufferAndArrayImplementation()
public String getName()
getName
in class FunctionEmitter
protected String getArgumentName(int i)
public String getRuntimeExceptionType()
java.lang.RuntimeException
) raised if runtime
checks fail in the generated code.public String getUnsupportedExceptionType()
public void setReturnedArrayLengthExpression(String expr)
public void setPrologue(List<String> prologue)
public void setEpilogue(List<String> epilogue)
public boolean signatureOnly()
public void setEmitBody(boolean emitBody)
public void setEraseBufferAndArrayTypes(boolean erase)
public void setForImplementingMethodCall(boolean impl)
public void setForDirectBufferImplementation(boolean direct)
public void setForIndirectBufferAndArrayImplementation(boolean indirect)
protected void emitReturnType(PrintWriter writer)
emitReturnType
in class FunctionEmitter
protected String getReturnTypeString(boolean skipArray)
protected void emitName(PrintWriter writer)
emitName
in class FunctionEmitter
protected int emitArguments(PrintWriter writer)
FunctionEmitter
emitArguments
in class FunctionEmitter
protected String getImplMethodName()
protected String byteOffsetArgName(int i)
protected String isNIOArgName(int i)
protected String byteOffsetArrayArgName(int i)
protected String offsetArgName(int i)
protected void emitBody(PrintWriter writer)
emitBody
in class FunctionEmitter
protected void emitPrologueOrEpilogue(List<String> code, PrintWriter writer)
protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer)
protected void emitArrayLengthAndNIOBufferChecks(MethodBinding binding, PrintWriter writer)
protected void emitCompoundArrayCopies(MethodBinding binding, PrintWriter writer)
protected void emitCall(MethodBinding binding, PrintWriter writer)
protected void emitReturnVariableSetupAndCall(MethodBinding binding, PrintWriter writer)
protected int emitCallArguments(MethodBinding binding, PrintWriter writer)
protected void emitPostCallCleanup(MethodBinding binding, PrintWriter writer)
protected void emitCallResultReturn(MethodBinding binding, PrintWriter writer)
protected String[] argumentNameArray()
public static String javaThisArgumentName()
protected String getCommentStartString()
getCommentStartString
in class FunctionEmitter
protected String getCommentEndString()
getCommentEndString
in class FunctionEmitter
protected String getBaseIndentString()
getBaseIndentString
in class FunctionEmitter
protected String getReturnedArrayLengthExpression()