aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-21 02:06:21 +0100
committerSven Gothel <[email protected]>2014-01-21 02:06:21 +0100
commitd0acda31e866040d8dbf8e72f983b78bafcb243a (patch)
tree7b6cabc81e6b896ef35df92f486f87de885a38e7 /src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
parent2ce522b01cc5f85084d373cefbe21ae706238191 (diff)
GlueGen: Add 'MethodJavadoc <method-name> comment-line..' configuration element, allowing to add custom API doc lines per method for the JavaMethodBindingEmitter
Diffstat (limited to 'src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java')
-rw-r--r--src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
index 46ecab2..8c9f8bf 100644
--- a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
@@ -48,6 +48,7 @@ import com.jogamp.gluegen.cgram.types.Type;
import java.io.PrintWriter;
import java.text.MessageFormat;
+import java.util.Iterator;
import java.util.List;
/**
@@ -67,8 +68,8 @@ public class JavaMethodBindingEmitter extends FunctionEmitter {
protected final CommentEmitter defaultInterfaceCommentEmitter = new InterfaceCommentEmitter();
// Exception type raised in the generated code if runtime checks fail
- private String runtimeExceptionType;
- private String unsupportedExceptionType;
+ private final String runtimeExceptionType;
+ private final String unsupportedExceptionType;
protected boolean emitBody;
protected boolean eraseBufferAndArrayTypes;
@@ -98,7 +99,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter {
private static final String COMPOUND_ARRAY_SUFFIX = "_buf_array_copy";
// Only present to provide more clear comments
- private JavaConfiguration cfg;
+ private final JavaConfiguration cfg;
public JavaMethodBindingEmitter(MethodBinding binding,
PrintWriter output,
@@ -797,6 +798,21 @@ public class JavaMethodBindingEmitter extends FunctionEmitter {
protected String getCommentStartString() { return "/** "; }
@Override
+ protected String getCommentEndString() {
+ final StringBuilder sb = new StringBuilder();
+ final String methodName = binding.getName();
+ final List<String> methodDocs = cfg.javadocForMethod(methodName);
+ for (Iterator<String> iter = methodDocs.iterator(); iter.hasNext(); ) {
+ sb.append(JavaConfiguration.NEWLINE).append(getBaseIndentString()).append(iter.next());
+ }
+ if( methodDocs.size() > 0 ) {
+ sb.append(JavaConfiguration.NEWLINE).append(getBaseIndentString());
+ }
+ sb.append(" */");
+ return sb.toString();
+ }
+
+ @Override
protected String getBaseIndentString() { return " "; }
protected String getReturnedArrayLengthExpression() {