Represents the binding of a C function to a Java method. Also used
to represent calls through function pointers contained in
structs.
MethodBinding
public MethodBinding(MethodBinding bindingToCopy)
Constructs a new MethodBinding that is an exact clone of the
argument, including the java return type and java argument
types. It's safe to modify this binding after construction.
MethodBinding
public MethodBinding(net.java.games.gluegen.cgram.types.FunctionSymbol sym)
Constructor for calling a C function.
MethodBinding
public MethodBinding(net.java.games.gluegen.cgram.types.FunctionSymbol sym,
JavaType containingType,
net.java.games.gluegen.cgram.types.Type containingCType)
Constructor for calling a function pointer contained in a
struct.
addJavaArgumentType
public void addJavaArgumentType(JavaType type)
clearThisPointer
public void clearThisPointer()
Clears any record of a this pointer for this MethodBinding.
clone
public final Object clone()
computeSignatureProperties
protected void computeSignatureProperties()
Computes summary information about the method's C and Java
signatures.
createCPrimitivePointerVariant
public MethodBinding createCPrimitivePointerVariant(int argumentNumber,
JavaType newArgType)
Replaces the C primitive pointer argument at slot argumentNumber
(0..getNumArguments() - 1) with the specified type. If
argumentNumber is less than 0 then replaces the return type.
createNIOBufferVariant
public MethodBinding createNIOBufferVariant()
equals
public boolean equals(Object obj)
findThisPointer
public void findThisPointer()
Find the leftmost argument matching the type of the containing
type (for function pointer MethodBindings) and record that as a
"this" pointer, meaning that it does not need to be explicitly
passed at the Java level.
getArgumentName
public String getArgumentName(int i)
Returns either the argument name specified by the underlying
FunctionSymbol or a fabricated argument name based on the
position. Note that it is currently not guaranteed that there
are no namespace clashes with these fabricated argument
names.
getCArgumentType
public net.java.games.gluegen.cgram.types.Type getCArgumentType(int i)
getCReturnType
public net.java.games.gluegen.cgram.types.Type getCReturnType()
getCSymbol
public net.java.games.gluegen.cgram.types.FunctionSymbol getCSymbol()
getContainingCType
public net.java.games.gluegen.cgram.types.Type getContainingCType()
Retrieves the containing C type of this MethodBinding if it is for
a function pointer contained in a struct.
getContainingType
public JavaType getContainingType()
Retrieves the containing type of this MethodBinding if it is for
a function pointer contained in a struct.
getJavaArgumentType
public JavaType getJavaArgumentType(int i)
getJavaReturnType
public JavaType getJavaReturnType()
getName
public String getName()
getNumArguments
public int getNumArguments()
hasContainingType
public boolean hasContainingType()
Indicates whether this MethodBinding is for a function pointer
contained in a struct.
isArgumentThisPointer
public boolean isArgumentThisPointer(int i)
Indicates whether the ith argument to this MethodBinding
is actually a "this" pointer.
setJavaReturnType
public void setJavaReturnType(JavaType type)
signatureUsesCArrays
public boolean signatureUsesCArrays()
Returns true if any of the outgoing arguments in the method's
signature represent fixed-length C arrays which require length
checking during the call.
signatureUsesNIO
public boolean signatureUsesNIO()
Returns true if the return type or any of the outgoing arguments
in the method's signature require conversion or checking due to
the use of New I/O.
signatureUsesPrimitiveArrays
public boolean signatureUsesPrimitiveArrays()
Returns true if any of the outgoing arguments in the method's
signature represent primitive arrays which require a
GetPrimitiveArrayCritical or similar operation during the call.
toString
public String toString()
Returns the signature of this binding.