summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/MethodBinding.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-11 08:48:36 +0100
committerSven Gothel <[email protected]>2015-03-11 08:48:36 +0100
commit405512e1c8a2e24834b0d057f0b020b4a0f4c25b (patch)
treeea933c02fa486c034f8d490ddc59a2afd95a4d3e /src/java/com/jogamp/gluegen/MethodBinding.java
parentf664f7e950ff60d73e488801cf7f37878588203d (diff)
Bug 1144 - Add 'DelegateImplementation', manually impl. may delegate to renamed original
'DelegateImplementation' is a variation of 'ManuallyImplement'. 'ManuallyImplement' emits the interface method, but suppresses the Java and native-code implementation. The latter shall be implemented manually by the user. 'DelegateImplementation' emits the interface method, and the _private_ renamed Java and native-code implementation. Both can be called from the manual user implementation, hence delegation. Configuration: DelegateImplementation <ORIG-SYMBOL> <RENAMED-IMPL-SYMBOL> I.e. delegation model shall apply to <ORIG-SYMBOL> and the Java and native-code implementation renamed to <RENAMED-IMPL-SYMBOL>. The user manual implementation of <ORIG-SYMBOL> may delegate to <RENAMED-IMPL-SYMBOL>.
Diffstat (limited to 'src/java/com/jogamp/gluegen/MethodBinding.java')
-rw-r--r--src/java/com/jogamp/gluegen/MethodBinding.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/java/com/jogamp/gluegen/MethodBinding.java b/src/java/com/jogamp/gluegen/MethodBinding.java
index 5b0290a..278fea0 100644
--- a/src/java/com/jogamp/gluegen/MethodBinding.java
+++ b/src/java/com/jogamp/gluegen/MethodBinding.java
@@ -52,6 +52,7 @@ import java.util.List;
public class MethodBinding {
private final FunctionSymbol sym;
+ private final String delegationImplName;
private final JavaType containingType;
private final Type containingCType;
private String nativeName;
@@ -77,6 +78,7 @@ public class MethodBinding {
*/
public MethodBinding(final MethodBinding bindingToCopy) {
this.sym = bindingToCopy.sym;
+ this.delegationImplName = bindingToCopy.delegationImplName;
this.containingType = bindingToCopy.containingType;
this.containingCType = bindingToCopy.containingCType;
@@ -105,11 +107,13 @@ public class MethodBinding {
* </p>
*/
public MethodBinding(final FunctionSymbol sym,
+ final String delegationImplName,
final JavaType javaReturnType,
final List<JavaType> javaArgumentTypes,
final JavaType containingType,
final Type containingCType) {
this.sym = sym;
+ this.delegationImplName = delegationImplName;
this.containingType = containingType;
this.containingCType = containingCType;
@@ -173,16 +177,28 @@ public class MethodBinding {
public String getName() {
return sym.getName();
}
+ /**
+ * The
+ * {@link JavaConfiguration#getDelegatedImplementation(com.jogamp.gluegen.cgram.types.AliasedSymbol) implementation delegation}
+ * name, or {@code null} for no delegation.
+ * @see #getImplName()
+ */
+ public String getDelegationImplName() {
+ return delegationImplName;
+ }
+
/** Returns the {@link FunctionSymbol}'s current {@link FunctionSymbol#getName() aliased} API name for the interface. */
public String getInterfaceName() {
return sym.getName();
}
/**
* Returns the {@link FunctionSymbol}'s name for the implementation,
- * which is the current {@link FunctionSymbol#getName() aliased} API name per default.
+ * which is the current {@link FunctionSymbol#getName() aliased} API name per default,
+ * or the {@link #getDelegationImplName() delegation} name.
+ * @see #getDelegationImplName()
*/
public String getImplName() {
- return sym.getName();
+ return null != delegationImplName ? delegationImplName : sym.getName();
}
/**
* Returns the {@link FunctionSymbol}'s name for the native function