Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Renamings.

  • Loading branch information...
commit 11bf929e61db6663c386b08a09e8738fbe60a1eb 1 parent 5e5aa17
Nicolas Gramlich authored
View
336 src/org/andengine/extension/scripting/generator/ClassGenerator.java
@@ -9,11 +9,11 @@
import org.andengine.extension.scripting.generator.util.Util;
import org.andengine.extension.scripting.generator.util.adt.CppFormatter;
import org.andengine.extension.scripting.generator.util.adt.JavaFormatter;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter.GenCppClassHeaderFileSegment;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter.GenCppClassSourceFileSegment;
-import org.andengine.extension.scripting.generator.util.adt.io.GenJavaClassFileWriter;
-import org.andengine.extension.scripting.generator.util.adt.io.GenJavaClassFileWriter.GenJavaClassSourceFileSegment;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter.ProxyCppClassHeaderFileSegment;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter.ProxyCppClassSourceFileSegment;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyJavaClassFileWriter;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyJavaClassFileWriter.ProxyJavaClassSourceFileSegment;
import com.thoughtworks.paranamer.ParameterNamesNotFoundException;
@@ -63,27 +63,27 @@ public ClassGenerator(final File pProxyJavaRoot, final File pProxyCppRoot, final
// ===========================================================
public void generateClassCode(final Class<?> pClass) throws IOException {
- final GenJavaClassFileWriter genJavaClassFileWriter = new GenJavaClassFileWriter(this.mProxyJavaRoot, pClass, this.mUtil, this.mGenJavaFormatter);
- final GenCppClassFileWriter genCppClassFileWriter = new GenCppClassFileWriter(this.mProxyCppRoot, pClass, this.mUtil, this.mGenCppFormatter);
+ final ProxyJavaClassFileWriter proxyJavaClassFileWriter = new ProxyJavaClassFileWriter(this.mProxyJavaRoot, pClass, this.mUtil, this.mGenJavaFormatter);
+ final ProxyCppClassFileWriter proxyCppClassFileWriter = new ProxyCppClassFileWriter(this.mProxyCppRoot, pClass, this.mUtil, this.mGenCppFormatter);
- genJavaClassFileWriter.begin();
- genCppClassFileWriter.begin();
+ proxyJavaClassFileWriter.begin();
+ proxyCppClassFileWriter.begin();
- this.generateClassHeader(pClass, genJavaClassFileWriter, genCppClassFileWriter);
- this.generateClassFields(pClass, genJavaClassFileWriter, genCppClassFileWriter);
+ this.generateClassHeader(pClass, proxyJavaClassFileWriter, proxyCppClassFileWriter);
+ this.generateClassFields(pClass, proxyJavaClassFileWriter, proxyCppClassFileWriter);
- this.generateClassConstructors(pClass, genJavaClassFileWriter, genCppClassFileWriter);
+ this.generateClassConstructors(pClass, proxyJavaClassFileWriter, proxyCppClassFileWriter);
if(!Modifier.isAbstract(pClass.getModifiers())) {
- this.generateClassMethods(pClass, genJavaClassFileWriter, genCppClassFileWriter);
+ this.generateClassMethods(pClass, proxyJavaClassFileWriter, proxyCppClassFileWriter);
}
- this.generateClassFooter(pClass, genJavaClassFileWriter, genCppClassFileWriter);
+ this.generateClassFooter(pClass, proxyJavaClassFileWriter, proxyCppClassFileWriter);
- genJavaClassFileWriter.end();
- genCppClassFileWriter.end();
+ proxyJavaClassFileWriter.end();
+ proxyCppClassFileWriter.end();
}
- private void generateClassHeader(final Class<?> pClass, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateClassHeader(final Class<?> pClass, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
final String genJavaClassName = this.mUtil.getGenJavaClassName(pClass);
final String genJavaClassPackageName = this.mUtil.getGenJavaClassPackageName(pClass);
final String genCppClassName = this.mUtil.getGenCppClassName(pClass);
@@ -92,26 +92,26 @@ private void generateClassHeader(final Class<?> pClass, final GenJavaClassFileWr
/* Generate Java header. */
{
/* Package. */
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.PACKAGE, "package %s;", genJavaClassPackageName).end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.PACKAGE, "package %s;", genJavaClassPackageName).end();
/* Imports. */
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.IMPORTS, "import %s;", pClass.getName()).end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.IMPORTS, "import %s;", pClass.getName()).end();
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.CONSTANTS);
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.CONSTRUCTORS);
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.FIELDS);
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.GETTERS_SETTERS);
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.METHODS);
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.STATIC_METHODS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.CONSTANTS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.CONSTRUCTORS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.FIELDS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.GETTERS_SETTERS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.METHODS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.STATIC_METHODS);
/* Class. */
if(Modifier.isAbstract(pClass.getModifiers())) {
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CLASS_START, "public abstract class %s extends %s {", genJavaClassName, pClass.getSimpleName()).end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CLASS_START, "public abstract class %s extends %s {", genJavaClassName, pClass.getSimpleName()).end();
} else {
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CLASS_START, "public class %s extends %s{", genJavaClassName, pClass.getSimpleName()).end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CLASS_START, "public class %s extends %s{", genJavaClassName, pClass.getSimpleName()).end();
}
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.STATIC_METHODS, "public static native void nativeInitClass();").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.STATIC_METHODS, "public static native void nativeInitClass();").end();
}
/* Generate native header. */
@@ -119,149 +119,149 @@ private void generateClassHeader(final Class<?> pClass, final GenJavaClassFileWr
/* Header. */
{
/* #ifdef. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#ifndef " + genCppClassName + "_H").end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#define " + genCppClassName + "_H").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#ifndef " + genCppClassName + "_H").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#define " + genCppClassName + "_H").end();
/* Imports. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, "#include <memory>").end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, "#include <jni.h>").end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, "#include \"src/AndEngineScriptingExtension.h\"").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, "#include <memory>").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, "#include <jni.h>").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, "#include \"src/AndEngineScriptingExtension.h\"").end();
/* Externs. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.EXTERNS, "extern \"C\" {").end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.EXTERNS);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.EXTERNS, "extern \"C\" {").end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.EXTERNS);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.EXTERNS, "JNIEXPORT void JNICALL %s(JNIEnv*, jclass);", genCppNativeInitClassJNIExportMethodName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.EXTERNS, "JNIEXPORT void JNICALL %s(JNIEnv*, jclass);", genCppNativeInitClassJNIExportMethodName).end();
/* Class. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, "class %s : ", genCppClassName);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, "class %s : ", genCppClassName);
final Class<?> superclass = pClass.getSuperclass();
if(Object.class.equals(superclass)) {
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, "#include \"src/Wrapper.h\"").end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, "public Wrapper");
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, "#include \"src/Wrapper.h\"").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, "public Wrapper");
} else {
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, this.mUtil.getGenCppClassInclude(superclass)).end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, "public %s", this.mUtil.getGenCppClassName(superclass));
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, this.mUtil.getGenCppClassInclude(superclass)).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, "public %s", this.mUtil.getGenCppClassName(superclass));
}
final Class<?>[] interfaces = pClass.getInterfaces();
for(final Class<?> interfaze : interfaces) {
if(this.mUtil.isGenClassIncluded(interfaze)) {
- this.generateIncludes(pGenCppClassFileWriter, interfaze);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, ", public %s", this.mUtil.getGenCppClassName(interfaze));
+ this.generateIncludes(pProxyCppClassFileWriter, interfaze);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, ", public %s", this.mUtil.getGenCppClassName(interfaze));
}
}
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, " {").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, " {").end();
/* Methods. */
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.METHODS_PUBLIC);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "public:").end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.METHODS_PUBLIC);
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "public:").end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC);
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.METHODS_PROTECTED);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PROTECTED, "protected:").end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.METHODS_PROTECTED);
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.METHODS_PROTECTED);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PROTECTED, "protected:").end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.METHODS_PROTECTED);
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.METHODS_PRIVATE);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PRIVATE, "private:").end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.METHODS_PRIVATE);
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.METHODS_PRIVATE);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PRIVATE, "private:").end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.METHODS_PRIVATE);
/* Wrapper-Constructor. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "%s(jobject);", genCppClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "%s(jobject);", genCppClassName).end();
/* Unwrapper. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual jobject unwrap();").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual jobject unwrap();").end();
}
/* Source. */
{
/* Includes. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.INCLUDES, "#include <cstdlib>").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.INCLUDES, "#include <cstdlib>").end();
final String genCppClassInclude = this.mUtil.getGenCppClassInclude(pClass);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.INCLUDES, genCppClassInclude).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.INCLUDES, genCppClassInclude).end();
/* Statics. */
final String genCppStaticClassMemberName = this.mUtil.getGenCppStaticClassMemberName(pClass);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.STATICS, "static jclass %s;", genCppStaticClassMemberName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.STATICS, "static jclass %s;", genCppStaticClassMemberName).end();
/* Class init. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.CLASS_INIT, "JNIEXPORT void JNICALL %s(JNIEnv* pJNIEnv, jclass pJClass) {", genCppNativeInitClassJNIExportMethodName).end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassSourceFileSegment.CLASS_INIT);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.CLASS_INIT, "JNIEXPORT void JNICALL %s(JNIEnv* pJNIEnv, jclass pJClass) {", genCppNativeInitClassJNIExportMethodName).end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassSourceFileSegment.CLASS_INIT);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.CLASS_INIT, "%s = (jclass)JNI_ENV()->NewGlobalRef(pJClass);", genCppStaticClassMemberName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.CLASS_INIT, "%s = (jclass)JNI_ENV()->NewGlobalRef(pJClass);", genCppStaticClassMemberName).end();
/* Wrapper-Constructor. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "%s::%s(jobject p%s) {", genCppClassName, genCppClassName, genJavaClassName).end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassSourceFileSegment.METHODS);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "this->mUnwrapped = p%s;", genJavaClassName).end();
- pGenCppClassFileWriter.decrementIndent(GenCppClassSourceFileSegment.METHODS);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "}").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "%s::%s(jobject p%s) {", genCppClassName, genCppClassName, genJavaClassName).end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassSourceFileSegment.METHODS);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "this->mUnwrapped = p%s;", genJavaClassName).end();
+ pProxyCppClassFileWriter.decrementIndent(ProxyCppClassSourceFileSegment.METHODS);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "}").end();
/* Unwrapper. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "jobject %s::unwrap() {", genCppClassName).end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassSourceFileSegment.METHODS);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "return this->mUnwrapped;").end();
- pGenCppClassFileWriter.decrementIndent(GenCppClassSourceFileSegment.METHODS);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "}").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "jobject %s::unwrap() {", genCppClassName).end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassSourceFileSegment.METHODS);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "return this->mUnwrapped;").end();
+ pProxyCppClassFileWriter.decrementIndent(ProxyCppClassSourceFileSegment.METHODS);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "}").end();
}
}
}
- private void generateClassFooter(final Class<?> pClass, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateClassFooter(final Class<?> pClass, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
/* Generate Java footer. */
{
/* Class. */
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CLASS_END, "}").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CLASS_END, "}").end();
}
/* Generate native footer. */
{
/* Externs. */
- pGenCppClassFileWriter.decrementIndent(GenCppClassHeaderFileSegment.EXTERNS);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.EXTERNS, "}").end();
+ pProxyCppClassFileWriter.decrementIndent(ProxyCppClassHeaderFileSegment.EXTERNS);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.EXTERNS, "}").end();
/* Class init. */
- pGenCppClassFileWriter.decrementIndent(GenCppClassSourceFileSegment.CLASS_INIT);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.CLASS_INIT, "}").end();
+ pProxyCppClassFileWriter.decrementIndent(ProxyCppClassSourceFileSegment.CLASS_INIT);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.CLASS_INIT, "}").end();
/* Class. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_END, "};").end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_END, "#endif").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_END, "};").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_END, "#endif").end();
}
}
- private void generateClassFields(final Class<?> pClass, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.FIELDS, "private final long mAddress;").end();
+ private void generateClassFields(final Class<?> pClass, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.FIELDS, "private final long mAddress;").end();
}
- private void generateClassConstructors(final Class<?> pClass, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) throws ParameterNamesNotFoundException {
+ private void generateClassConstructors(final Class<?> pClass, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) throws ParameterNamesNotFoundException {
boolean zeroArgumentConstructorFound = false;
final Constructor<?>[] constructors = pClass.getConstructors();
for(final Constructor<?> constructor : constructors) {
if(constructor.getParameterTypes().length == 0) {
zeroArgumentConstructorFound = true;
}
- this.generateClassConstructor(pClass, constructor, pGenJavaClassFileWriter, pGenCppClassFileWriter);
+ this.generateClassConstructor(pClass, constructor, pProxyJavaClassFileWriter, pProxyCppClassFileWriter);
}
/* We need to generate a zero-arg constructor on the native side, so that the subclasses can make use of this constructor. */
// TODO Think if generating a protected zero-arg constructor is viable in all cases.
if(!zeroArgumentConstructorFound) {
- this.generateZeroArgumentNativeConstructor(pClass, pGenJavaClassFileWriter, pGenCppClassFileWriter);
+ this.generateZeroArgumentNativeConstructor(pClass, pProxyJavaClassFileWriter, pProxyCppClassFileWriter);
}
}
- private void generateZeroArgumentNativeConstructor(final Class<?> pClass, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateZeroArgumentNativeConstructor(final Class<?> pClass, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
final String genCppClassName = this.mUtil.getGenCppClassName(pClass);
/* Header. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, genCppClassName).append("();").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, genCppClassName).append("();").end();
/* Source. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "%s::%s() {", genCppClassName, genCppClassName).end();
- pGenCppClassFileWriter.endLine(GenCppClassSourceFileSegment.METHODS);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "}").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "%s::%s() {", genCppClassName, genCppClassName).end();
+ pProxyCppClassFileWriter.endLine(ProxyCppClassSourceFileSegment.METHODS);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "}").end();
}
- private void generateClassConstructor(final Class<?> pClass, final Constructor<?> pConstructor, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateClassConstructor(final Class<?> pClass, final Constructor<?> pConstructor, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
final String genJavaClassName = this.mUtil.getGenJavaClassName(pClass);
final String genCppClassName = this.mUtil.getGenCppClassName(pClass);
@@ -275,47 +275,47 @@ private void generateClassConstructor(final Class<?> pClass, final Constructor<?
final String methodCallParamatersAsString = this.mUtil.getJavaMethodCallParamatersAsString(pConstructor);
if(pConstructor.isAnnotationPresent(Deprecated.class)) {
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, "@Deprecated").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, "@Deprecated").end();
}
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, "%s %s(", visibilityModifiers, genJavaClassName);
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, "final long pAddress");
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, "%s %s(", visibilityModifiers, genJavaClassName);
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, "final long pAddress");
if(methodParamatersAsString != null) {
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, ", %s", methodParamatersAsString);
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, ", %s", methodParamatersAsString);
}
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, ") ");
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, ") ");
final Class<?>[] exceptions = pConstructor.getExceptionTypes();
if(exceptions.length > 0) {
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, "throws ");
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, "throws ");
for(int i = 0; i < exceptions.length; i++) {
final Class<?> exception = exceptions[i];
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, exception.getSimpleName());
- this.generateImports(pGenJavaClassFileWriter, exception);
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, exception.getSimpleName());
+ this.generateImports(pProxyJavaClassFileWriter, exception);
final boolean isLastException = (i == (exceptions.length - 1));
if(!isLastException) {
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, ", ");
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, ", ");
}
}
}
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, "{").end();
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.CONSTRUCTORS);
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, "{").end();
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.CONSTRUCTORS);
/* Super call. */
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, "super(");
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, "super(");
if(methodCallParamatersAsString != null) {
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, methodCallParamatersAsString);
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, methodCallParamatersAsString);
}
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, ");").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, ");").end();
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, "this.mAddress = pAddress;").end();
- pGenJavaClassFileWriter.decrementIndent(GenJavaClassSourceFileSegment.CONSTRUCTORS);
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CONSTRUCTORS, "}").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, "this.mAddress = pAddress;").end();
+ pProxyJavaClassFileWriter.decrementIndent(ProxyJavaClassSourceFileSegment.CONSTRUCTORS);
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CONSTRUCTORS, "}").end();
/* Add imports. */
- this.generateParameterImportsAndIncludes(pConstructor, pGenJavaClassFileWriter, pGenCppClassFileWriter);
+ this.generateParameterImportsAndIncludes(pConstructor, pProxyJavaClassFileWriter, pProxyCppClassFileWriter);
}
/* Generate native constructor. */
{
- final GenCppClassHeaderFileSegment genCppClassHeaderFileSegment = this.mUtil.getGenCppClassHeaderFileSegmentByVisibilityModifier(modifiers);
+ final ProxyCppClassHeaderFileSegment proxyCppClassHeaderFileSegment = this.mUtil.getGenCppClassHeaderFileSegmentByVisibilityModifier(modifiers);
final String genCppMethodHeaderParamatersAsString = this.mUtil.getGenCppMethodHeaderParamatersAsString(pConstructor);
final String genCppMethodParamatersAsString = this.mUtil.getGenCppMethodParamatersAsString(pConstructor);
@@ -324,57 +324,57 @@ private void generateClassConstructor(final Class<?> pClass, final Constructor<?
final String jniMethodSignature = this.mUtil.getJNIMethodSignature(pConstructor);
/* Header. */
- pGenCppClassFileWriter.append(genCppClassHeaderFileSegment, genCppClassName);
- pGenCppClassFileWriter.append(genCppClassHeaderFileSegment, "(");
+ pProxyCppClassFileWriter.append(proxyCppClassHeaderFileSegment, genCppClassName);
+ pProxyCppClassFileWriter.append(proxyCppClassHeaderFileSegment, "(");
if(genCppMethodHeaderParamatersAsString != null) {
- pGenCppClassFileWriter.append(genCppClassHeaderFileSegment, genCppMethodHeaderParamatersAsString);
+ pProxyCppClassFileWriter.append(proxyCppClassHeaderFileSegment, genCppMethodHeaderParamatersAsString);
}
- pGenCppClassFileWriter.append(genCppClassHeaderFileSegment, ");").end();
+ pProxyCppClassFileWriter.append(proxyCppClassHeaderFileSegment, ");").end();
final String constructorName = this.mUtil.getGenCppStaticMethodIDFieldName(pConstructor);
/* Source. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.STATICS, "static jmethodID %s;", constructorName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.STATICS, "static jmethodID %s;", constructorName).end();
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.CLASS_INIT, "%s = JNI_ENV()->GetMethodID(%s, \"<init>\", \"%s\");", constructorName, genCppStaticClassMemberName, jniMethodSignature).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.CLASS_INIT, "%s = JNI_ENV()->GetMethodID(%s, \"<init>\", \"%s\");", constructorName, genCppStaticClassMemberName, jniMethodSignature).end();
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "%s::%s(", genCppClassName, genCppClassName);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "%s::%s(", genCppClassName, genCppClassName);
if(genCppMethodParamatersAsString != null) {
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, genCppMethodParamatersAsString);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, genCppMethodParamatersAsString);
}
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, ") {").end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassSourceFileSegment.METHODS);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "this->mUnwrapped = JNI_ENV()->NewObject(%s, %s", genCppStaticClassMemberName, constructorName);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, ") {").end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassSourceFileSegment.METHODS);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "this->mUnwrapped = JNI_ENV()->NewObject(%s, %s", genCppStaticClassMemberName, constructorName);
if(genJNIMethodCallParamatersAsString != null) {
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, ", (jlong)this, %s);", genJNIMethodCallParamatersAsString).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, ", (jlong)this, %s);", genJNIMethodCallParamatersAsString).end();
} else {
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, ", (jlong)this);").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, ", (jlong)this);").end();
}
- pGenCppClassFileWriter.decrementIndent(GenCppClassSourceFileSegment.METHODS);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "}").end();
+ pProxyCppClassFileWriter.decrementIndent(ProxyCppClassSourceFileSegment.METHODS);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "}").end();
}
}
}
- private void generateClassMethods(final Class<?> pClass, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateClassMethods(final Class<?> pClass, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
for(final Method method : pClass.getMethods()) {
if(this.mUtil.isGenMethodIncluded(method)) {
final String methodName = method.getName();
if(methodName.startsWith("on")) {
- this.generateClassCallback(pClass, method, pGenJavaClassFileWriter, pGenCppClassFileWriter);
+ this.generateClassCallback(pClass, method, pProxyJavaClassFileWriter, pProxyCppClassFileWriter);
} else {
- this.generateClassMethod(pClass, method, pGenJavaClassFileWriter, pGenCppClassFileWriter);
+ this.generateClassMethod(pClass, method, pProxyJavaClassFileWriter, pProxyCppClassFileWriter);
}
}
}
}
- private void generateClassCallback(final Class<?> pClass, final Method pMethod, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateClassCallback(final Class<?> pClass, final Method pMethod, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
final Class<?> returnType = pMethod.getReturnType();
final String methodName = pMethod.getName();
if((returnType == Boolean.TYPE) || (returnType == Void.TYPE)) {
if(Modifier.isPublic(pMethod.getModifiers())) { // TODO Is this check correct?
- this.generateParameterImportsAndIncludes(pMethod, pGenJavaClassFileWriter, pGenCppClassFileWriter);
+ this.generateParameterImportsAndIncludes(pMethod, pProxyJavaClassFileWriter, pProxyCppClassFileWriter);
final String[] parameterNames = this.mUtil.getParameterNames(pMethod);
final Class<?>[] parameterTypes = this.mUtil.getParameterTypes(pMethod);
@@ -391,28 +391,28 @@ private void generateClassCallback(final Class<?> pClass, final Method pMethod,
final String methodCallParamatersAsString = this.mUtil.getJavaMethodCallParamatersAsString(pMethod);
/* Source. */
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "@Override").end();
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "%s %s %s(%s) {", visibilityModifier, returnType.getSimpleName(), methodName, (methodParamatersAsString != null) ? methodParamatersAsString : "").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "@Override").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "%s %s %s(%s) {", visibilityModifier, returnType.getSimpleName(), methodName, (methodParamatersAsString != null) ? methodParamatersAsString : "").end();
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.METHODS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.METHODS);
if(returnType == Void.TYPE) {
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "if(!this.%s(this.mAddress%s)) {", javaNativeMethodName, (methodCallParamatersAsString != null) ? ", " + methodCallParamatersAsString : "");
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "\tsuper.%s(%s);", methodName, (methodCallParamatersAsString != null) ? methodCallParamatersAsString : "");
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "}").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "if(!this.%s(this.mAddress%s)) {", javaNativeMethodName, (methodCallParamatersAsString != null) ? ", " + methodCallParamatersAsString : "");
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "\tsuper.%s(%s);", methodName, (methodCallParamatersAsString != null) ? methodCallParamatersAsString : "");
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "}").end();
} else if(returnType == Boolean.TYPE) {
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "final boolean handledNative = this.%s(this.mAddress%s);", javaNativeMethodName, (methodCallParamatersAsString != null) ? ", " + methodCallParamatersAsString : "");
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "if(handledNative) {").end();
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "\treturn true;").end();
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "} else {").end();
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "\treturn super.%s(%s);", methodName, (methodParamatersAsString != null) ? methodCallParamatersAsString : "");
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "}").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "final boolean handledNative = this.%s(this.mAddress%s);", javaNativeMethodName, (methodCallParamatersAsString != null) ? ", " + methodCallParamatersAsString : "");
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "if(handledNative) {").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "\treturn true;").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "} else {").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "\treturn super.%s(%s);", methodName, (methodParamatersAsString != null) ? methodCallParamatersAsString : "");
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "}").end();
} else {
throw new IllegalStateException("Unexpected return type: '" + returnType.getName() + "'.");
}
- pGenJavaClassFileWriter.decrementIndent(GenJavaClassSourceFileSegment.METHODS);
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "}").end();
+ pProxyJavaClassFileWriter.decrementIndent(ProxyJavaClassSourceFileSegment.METHODS);
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "}").end();
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.METHODS, "private native boolean %s(final long pAddress%s);", javaNativeMethodName, (methodParamatersAsString != null) ? ", " + methodParamatersAsString : "");
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.METHODS, "private native boolean %s(final long pAddress%s);", javaNativeMethodName, (methodParamatersAsString != null) ? ", " + methodParamatersAsString : "");
}
/* Generate native side of the callback. */
@@ -425,39 +425,39 @@ private void generateClassCallback(final Class<?> pClass, final Method pMethod,
/* Header. */
{
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.EXTERNS, "JNIEXPORT jboolean JNICALL %s(%s);", jniExportMethodName, jniExportMethodHeaderParamatersAsString).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.EXTERNS, "JNIEXPORT jboolean JNICALL %s(%s);", jniExportMethodName, jniExportMethodHeaderParamatersAsString).end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual jboolean %s(%s);", methodName, (cppMethodHeaderParamatersAsString != null) ? cppMethodHeaderParamatersAsString : "").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual jboolean %s(%s);", methodName, (cppMethodHeaderParamatersAsString != null) ? cppMethodHeaderParamatersAsString : "").end();
}
/* Source. */
{
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.JNI_EXPORTS, "JNIEXPORT jboolean JNICALL %s(%s) {", jniExportMethodName, jniExportMethodParamatersAsString);
- pGenCppClassFileWriter.incrementIndent(GenCppClassSourceFileSegment.JNI_EXPORTS);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.JNI_EXPORTS, "%s* %s = (%s*)pAddress;", genCppClassName, uncapitalizedGenCppClassName, genCppClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.JNI_EXPORTS, "JNIEXPORT jboolean JNICALL %s(%s) {", jniExportMethodName, jniExportMethodParamatersAsString);
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassSourceFileSegment.JNI_EXPORTS);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.JNI_EXPORTS, "%s* %s = (%s*)pAddress;", genCppClassName, uncapitalizedGenCppClassName, genCppClassName).end();
/* Wrap non-primitives in local variables on the stack. */
{
- this.generateIncludes(pGenCppClassFileWriter, parameterTypes);
+ this.generateIncludes(pProxyCppClassFileWriter, parameterTypes);
for(int i = 0; i < parameterTypes.length; i++) {
final Class<?> parameterType = parameterTypes[i];
final String parameterName = parameterNames[i];
if(!this.mUtil.isPrimitiveType(parameterType)) {
final String genCppParameterTypeName = this.mUtil.getGenCppClassName(parameterType);
final String uncapitalizedGenCppParameterTypeName = this.mUtil.getGenCppLocalVariableParameterName(parameterName);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.JNI_EXPORTS, "%s %s(%s);", genCppParameterTypeName, uncapitalizedGenCppParameterTypeName, parameterName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.JNI_EXPORTS, "%s %s(%s);", genCppParameterTypeName, uncapitalizedGenCppParameterTypeName, parameterName).end();
}
}
}
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.JNI_EXPORTS, "return %s->%s(%s);", uncapitalizedGenCppClassName, methodName, (cppMethodCallParamatersAsString != null) ? cppMethodCallParamatersAsString : "");
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.JNI_EXPORTS, "return %s->%s(%s);", uncapitalizedGenCppClassName, methodName, (cppMethodCallParamatersAsString != null) ? cppMethodCallParamatersAsString : "");
- pGenCppClassFileWriter.decrementIndent(GenCppClassSourceFileSegment.JNI_EXPORTS);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.JNI_EXPORTS, "}").end();
+ pProxyCppClassFileWriter.decrementIndent(ProxyCppClassSourceFileSegment.JNI_EXPORTS);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.JNI_EXPORTS, "}").end();
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "jboolean %s::%s(%s) {", genCppClassName, methodName, (cppMethodParamatersAsString != null) ? cppMethodParamatersAsString : "").end();
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "\treturn false;").end();
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "}").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "jboolean %s::%s(%s) {", genCppClassName, methodName, (cppMethodParamatersAsString != null) ? cppMethodParamatersAsString : "").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "\treturn false;").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "}").end();
}
}
} else {
@@ -468,10 +468,10 @@ private void generateClassCallback(final Class<?> pClass, final Method pMethod,
}
}
- private void generateClassMethod(final Class<?> pClass, final Method pMethod, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateClassMethod(final Class<?> pClass, final Method pMethod, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
final Class<?> returnType = pMethod.getReturnType();
- this.generateParameterImportsAndIncludes(pMethod, pGenJavaClassFileWriter, pGenCppClassFileWriter);
+ this.generateParameterImportsAndIncludes(pMethod, pProxyJavaClassFileWriter, pProxyCppClassFileWriter);
final String genCppMethodHeaderParamatersAsString = this.mUtil.getGenCppMethodHeaderParamatersAsString(pMethod);
final String genCppMethodParamatersAsString = this.mUtil.getGenCppMethodParamatersAsString(pMethod);
@@ -487,28 +487,28 @@ private void generateClassMethod(final Class<?> pClass, final Method pMethod, fi
/* Generate native side of the getter. */
{
/* Generate virtual method in Header. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual %s %s(%s);", returnTypeGenCppParameterTypeName, methodName, (genCppMethodHeaderParamatersAsString != null) ? genCppMethodHeaderParamatersAsString : "").end(); // TODO Visiblity Modifier?
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual %s %s(%s);", returnTypeGenCppParameterTypeName, methodName, (genCppMethodHeaderParamatersAsString != null) ? genCppMethodHeaderParamatersAsString : "").end(); // TODO Visiblity Modifier?
/* Generate static methodID field. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.STATICS, "static jmethodID %s;", genCppStaticMethodIDFieldName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.STATICS, "static jmethodID %s;", genCppStaticMethodIDFieldName).end();
/* Cache static methodID field. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.CLASS_INIT, "%s = JNI_ENV()->GetMethodID(%s, \"%s\", \"%s\");", genCppStaticMethodIDFieldName, genCppStaticClassMemberName, methodName, jniMethodSignature).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.CLASS_INIT, "%s = JNI_ENV()->GetMethodID(%s, \"%s\", \"%s\");", genCppStaticMethodIDFieldName, genCppStaticClassMemberName, methodName, jniMethodSignature).end();
/* Call java method using static methodID field. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "%s %s::%s(%s) {", returnTypeGenCppParameterTypeName, genCppClassName, methodName, (genCppMethodParamatersAsString != null) ? genCppMethodParamatersAsString : "").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "%s %s::%s(%s) {", returnTypeGenCppParameterTypeName, genCppClassName, methodName, (genCppMethodParamatersAsString != null) ? genCppMethodParamatersAsString : "").end();
final boolean primitiveReturnType = this.mUtil.isPrimitiveType(returnType, false);
if(primitiveReturnType) {
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "\t");
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "\t");
if(returnType != Void.TYPE) {
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "return ");
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "return ");
}
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "JNI_ENV()->%s(this->mUnwrapped, %s%s);", this.mUtil.getJNICallXYZMethodName(pMethod.getReturnType()), genCppStaticMethodIDFieldName, (jniMethodCallParamatersAsString != null) ? ", " + jniMethodCallParamatersAsString: "").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "JNI_ENV()->%s(this->mUnwrapped, %s%s);", this.mUtil.getJNICallXYZMethodName(pMethod.getReturnType()), genCppStaticMethodIDFieldName, (jniMethodCallParamatersAsString != null) ? ", " + jniMethodCallParamatersAsString: "").end();
} else {
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "\treturn new %s(JNI_ENV()->%s(this->mUnwrapped, %s%s));", returnTypeGenCppParameterTypeNameWithoutPtr, this.mUtil.getJNICallXYZMethodName(pMethod.getReturnType()), genCppStaticMethodIDFieldName, (jniMethodCallParamatersAsString != null) ? ", " + jniMethodCallParamatersAsString: "").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "\treturn new %s(JNI_ENV()->%s(this->mUnwrapped, %s%s));", returnTypeGenCppParameterTypeNameWithoutPtr, this.mUtil.getJNICallXYZMethodName(pMethod.getReturnType()), genCppStaticMethodIDFieldName, (jniMethodCallParamatersAsString != null) ? ", " + jniMethodCallParamatersAsString: "").end();
}
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "}").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "}").end();
}
}
View
118 src/org/andengine/extension/scripting/generator/EnumGenerator.java
@@ -6,11 +6,11 @@
import org.andengine.extension.scripting.generator.util.Util;
import org.andengine.extension.scripting.generator.util.adt.CppFormatter;
import org.andengine.extension.scripting.generator.util.adt.JavaFormatter;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter.GenCppClassHeaderFileSegment;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter.GenCppClassSourceFileSegment;
-import org.andengine.extension.scripting.generator.util.adt.io.GenJavaClassFileWriter;
-import org.andengine.extension.scripting.generator.util.adt.io.GenJavaClassFileWriter.GenJavaClassSourceFileSegment;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter.ProxyCppClassHeaderFileSegment;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter.ProxyCppClassSourceFileSegment;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyJavaClassFileWriter;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyJavaClassFileWriter.ProxyJavaClassSourceFileSegment;
/**
* (c) Zynga 2012
@@ -58,21 +58,21 @@ public EnumGenerator(final File pProxyJavaRoot, final File pProxyCppRoot, final
// ===========================================================
public void generateEnumCode(final Class<?> pClass) throws IOException {
- final GenJavaClassFileWriter genJavaClassFileWriter = new GenJavaClassFileWriter(this.mProxyJavaRoot, pClass, this.mUtil, this.mProxyJavaFormatter);
- final GenCppClassFileWriter genCppClassFileWriter = new GenCppClassFileWriter(this.mProxyCppRoot, pClass, this.mUtil, this.mProxyCppFormatter);
+ final ProxyJavaClassFileWriter proxyJavaClassFileWriter = new ProxyJavaClassFileWriter(this.mProxyJavaRoot, pClass, this.mUtil, this.mProxyJavaFormatter);
+ final ProxyCppClassFileWriter proxyCppClassFileWriter = new ProxyCppClassFileWriter(this.mProxyCppRoot, pClass, this.mUtil, this.mProxyCppFormatter);
- genJavaClassFileWriter.begin();
- genCppClassFileWriter.begin();
+ proxyJavaClassFileWriter.begin();
+ proxyCppClassFileWriter.begin();
- this.generateEnumHeader(pClass, genJavaClassFileWriter, genCppClassFileWriter);
- this.generateEnumMethods(pClass, genJavaClassFileWriter, genCppClassFileWriter);
- this.generateEnumFooter(pClass, genJavaClassFileWriter, genCppClassFileWriter);
+ this.generateEnumHeader(pClass, proxyJavaClassFileWriter, proxyCppClassFileWriter);
+ this.generateEnumMethods(pClass, proxyJavaClassFileWriter, proxyCppClassFileWriter);
+ this.generateEnumFooter(pClass, proxyJavaClassFileWriter, proxyCppClassFileWriter);
- genJavaClassFileWriter.end();
- genCppClassFileWriter.end();
+ proxyJavaClassFileWriter.end();
+ proxyCppClassFileWriter.end();
}
- private void generateEnumHeader(final Class<?> pClass, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateEnumHeader(final Class<?> pClass, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
final String genJavaClassName = this.mUtil.getGenJavaClassName(pClass);
final String genCppClassName = this.mUtil.getGenCppClassName(pClass);
final String genJavaClassPackageName = this.mUtil.getGenJavaClassPackageName(pClass);
@@ -81,19 +81,19 @@ private void generateEnumHeader(final Class<?> pClass, final GenJavaClassFileWri
/* Generate Java header. */
{
/* Package. */
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.PACKAGE, "package %s;", genJavaClassPackageName).end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.PACKAGE, "package %s;", genJavaClassPackageName).end();
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.CONSTANTS);
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.CONSTRUCTORS);
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.FIELDS);
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.GETTERS_SETTERS);
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.METHODS);
- pGenJavaClassFileWriter.incrementIndent(GenJavaClassSourceFileSegment.STATIC_METHODS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.CONSTANTS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.CONSTRUCTORS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.FIELDS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.GETTERS_SETTERS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.METHODS);
+ pProxyJavaClassFileWriter.incrementIndent(ProxyJavaClassSourceFileSegment.STATIC_METHODS);
/* Class. */
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CLASS_START, "public class %s {", genJavaClassName).end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CLASS_START, "public class %s {", genJavaClassName).end();
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.STATIC_METHODS, "public static native void nativeInitClass();").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.STATIC_METHODS, "public static native void nativeInitClass();").end();
}
/* Generate native header. */
@@ -101,97 +101,97 @@ private void generateEnumHeader(final Class<?> pClass, final GenJavaClassFileWri
/* Header. */
{
/* #ifdef. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#ifndef %s_H", genCppClassName).end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#define %s_H", genCppClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#ifndef %s_H", genCppClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#define %s_H", genCppClassName).end();
/* Imports. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, "#include <jni.h>").end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, "#include \"src/AndEngineScriptingExtension.h\"").end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, "#include \"src/Wrapper.h\"").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, "#include <jni.h>").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, "#include \"src/AndEngineScriptingExtension.h\"").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, "#include \"src/Wrapper.h\"").end();
/* Externs. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.EXTERNS, "extern \"C\" {").end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.EXTERNS);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.EXTERNS, "extern \"C\" {").end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.EXTERNS);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.EXTERNS, "JNIEXPORT void JNICALL %s(JNIEnv*, jclass);", genCppNativeInitClassJNIExportMethodName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.EXTERNS, "JNIEXPORT void JNICALL %s(JNIEnv*, jclass);", genCppNativeInitClassJNIExportMethodName).end();
/* Class. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, "class %s : public Wrapper {", genCppClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, "class %s : public Wrapper {", genCppClassName).end();
/* Methods. */
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.METHODS_PUBLIC);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "public:").end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.METHODS_PUBLIC);
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "public:").end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC);
/* Wrapper-Constructor */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "%s(jobject);", genCppClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "%s(jobject);", genCppClassName).end();
for(final Object enumConstant : pClass.getEnumConstants()) {
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "static %s* %s;", genCppClassName, enumConstant.toString()).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "static %s* %s;", genCppClassName, enumConstant.toString()).end();
}
}
/* Source. */
{
/* Includes. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.INCLUDES, "#include <cstdlib>").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.INCLUDES, "#include <cstdlib>").end();
final String genCppClassInclude = this.mUtil.getGenCppClassInclude(pClass);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.INCLUDES, genCppClassInclude).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.INCLUDES, genCppClassInclude).end();
/* Statics. */
final String genCppStaticClassMemberName = this.mUtil.getGenCppStaticClassMemberName(pClass, true);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.STATICS, "static jclass %s;", genCppStaticClassMemberName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.STATICS, "static jclass %s;", genCppStaticClassMemberName).end();
/* Class init. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.CLASS_INIT, "JNIEXPORT void JNICALL %s(JNIEnv* pJNIEnv, jclass pJClass) {", genCppNativeInitClassJNIExportMethodName).end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassSourceFileSegment.CLASS_INIT);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.CLASS_INIT, "JNIEXPORT void JNICALL %s(JNIEnv* pJNIEnv, jclass pJClass) {", genCppNativeInitClassJNIExportMethodName).end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassSourceFileSegment.CLASS_INIT);
final String genCppFullyQualifiedClassName = this.mUtil.getGenCppFullyQualifiedClassName(pClass, true);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.CLASS_INIT, "%s = (jclass)JNI_ENV()->NewGlobalRef(JNI_ENV()->FindClass(\"%s\"));", genCppStaticClassMemberName, genCppFullyQualifiedClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.CLASS_INIT, "%s = (jclass)JNI_ENV()->NewGlobalRef(JNI_ENV()->FindClass(\"%s\"));", genCppStaticClassMemberName, genCppFullyQualifiedClassName).end();
/* Enum-Values. */
final String jniSignatureType = this.mUtil.getJNIMethodSignatureType(pClass);
for(final Object enumConstant : pClass.getEnumConstants()) {
final String enumName = enumConstant.toString();
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.STATICS, "%s* %s::%s = NULL;", genCppClassName, genCppClassName, enumName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.STATICS, "%s* %s::%s = NULL;", genCppClassName, genCppClassName, enumName).end();
final String jfieldIDLocalVariableName = genCppClassName + "_" + enumName + "_ID";
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.CLASS_INIT, "jfieldID %s = JNI_ENV()->GetStaticFieldID(%s, \"%s\", \"%s\");", jfieldIDLocalVariableName, genCppStaticClassMemberName, enumName, jniSignatureType).end();
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.CLASS_INIT, "%s::%s = new %s(JNI_ENV()->GetStaticObjectField(%s, %s));", genCppClassName, enumName, genCppClassName, genCppStaticClassMemberName, jfieldIDLocalVariableName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.CLASS_INIT, "jfieldID %s = JNI_ENV()->GetStaticFieldID(%s, \"%s\", \"%s\");", jfieldIDLocalVariableName, genCppStaticClassMemberName, enumName, jniSignatureType).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.CLASS_INIT, "%s::%s = new %s(JNI_ENV()->GetStaticObjectField(%s, %s));", genCppClassName, enumName, genCppClassName, genCppStaticClassMemberName, jfieldIDLocalVariableName).end();
}
/* Wrapper-Constructor. */
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "%s::%s(jobject p%s) {", genCppClassName, genCppClassName, genJavaClassName).end();
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "\tthis->mUnwrapped = p%s;", genJavaClassName).end();
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.METHODS, "}").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "%s::%s(jobject p%s) {", genCppClassName, genCppClassName, genJavaClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "\tthis->mUnwrapped = p%s;", genJavaClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.METHODS, "}").end();
}
}
}
- private void generateEnumMethods(final Class<?> pClass, GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateEnumMethods(final Class<?> pClass, ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
// TODO
}
- private void generateEnumFooter(final Class<?> pClass, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateEnumFooter(final Class<?> pClass, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
/* Generate Java footer. */
{
/* Class. */
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.CLASS_END, "}").end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.CLASS_END, "}").end();
}
/* Generate native footer. */
{
/* Externs. */
- pGenCppClassFileWriter.decrementIndent(GenCppClassHeaderFileSegment.EXTERNS);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.EXTERNS, "}").end();
+ pProxyCppClassFileWriter.decrementIndent(ProxyCppClassHeaderFileSegment.EXTERNS);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.EXTERNS, "}").end();
/* Class init. */
- pGenCppClassFileWriter.decrementIndent(GenCppClassSourceFileSegment.CLASS_INIT);
- pGenCppClassFileWriter.append(GenCppClassSourceFileSegment.CLASS_INIT, "}").end();
+ pProxyCppClassFileWriter.decrementIndent(ProxyCppClassSourceFileSegment.CLASS_INIT);
+ pProxyCppClassFileWriter.append(ProxyCppClassSourceFileSegment.CLASS_INIT, "}").end();
/* Class. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_END, "};").end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_END, "#endif").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_END, "};").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_END, "#endif").end();
}
}
View
38 src/org/andengine/extension/scripting/generator/Generator.java
@@ -6,10 +6,10 @@
import java.util.List;
import org.andengine.extension.scripting.generator.util.Util;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter.GenCppClassHeaderFileSegment;
-import org.andengine.extension.scripting.generator.util.adt.io.GenJavaClassFileWriter;
-import org.andengine.extension.scripting.generator.util.adt.io.GenJavaClassFileWriter.GenJavaClassSourceFileSegment;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter.ProxyCppClassHeaderFileSegment;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyJavaClassFileWriter;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyJavaClassFileWriter.ProxyJavaClassSourceFileSegment;
/**
* (c) Zynga 2012
@@ -48,57 +48,57 @@ public Generator(final Util pUtil) {
// Methods
// ===========================================================
- protected void generateParameterImportsAndIncludes(final AccessibleObject pAccessibleObject, final GenJavaClassFileWriter pGenJavaClassFileWriter, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ protected void generateParameterImportsAndIncludes(final AccessibleObject pAccessibleObject, final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
if(pAccessibleObject instanceof Constructor<?>) {
final Constructor<?> constructor = (Constructor<?>)pAccessibleObject;
final Class<?>[] parameterTypes = constructor.getParameterTypes();
- this.generateImports(pGenJavaClassFileWriter, parameterTypes);
- this.generateIncludes(pGenCppClassFileWriter, parameterTypes);
+ this.generateImports(pProxyJavaClassFileWriter, parameterTypes);
+ this.generateIncludes(pProxyCppClassFileWriter, parameterTypes);
} else if(pAccessibleObject instanceof Method) {
final Method method = (Method)pAccessibleObject;
final Class<?>[] parameterTypes = method.getParameterTypes();
- this.generateImports(pGenJavaClassFileWriter, parameterTypes);
- this.generateIncludes(pGenCppClassFileWriter, parameterTypes);
+ this.generateImports(pProxyJavaClassFileWriter, parameterTypes);
+ this.generateIncludes(pProxyCppClassFileWriter, parameterTypes);
- this.generateImports(pGenJavaClassFileWriter, method.getReturnType());
- this.generateIncludes(pGenCppClassFileWriter, method.getReturnType());
+ this.generateImports(pProxyJavaClassFileWriter, method.getReturnType());
+ this.generateIncludes(pProxyCppClassFileWriter, method.getReturnType());
} else {
throw new IllegalArgumentException();
}
}
- protected void generateIncludes(final GenCppClassFileWriter pGenCppClassFileWriter, final AccessibleObject pAccessibleObject) {
+ protected void generateIncludes(final ProxyCppClassFileWriter pProxyCppClassFileWriter, final AccessibleObject pAccessibleObject) {
if(pAccessibleObject instanceof Constructor<?>) {
final Constructor<?> constructor = (Constructor<?>)pAccessibleObject;
- this.generateIncludes(pGenCppClassFileWriter, constructor.getParameterTypes());
+ this.generateIncludes(pProxyCppClassFileWriter, constructor.getParameterTypes());
} else if(pAccessibleObject instanceof Method) {
final Method method = (Method)pAccessibleObject;
final Class<?>[] parameterTypes = method.getParameterTypes();
- this.generateIncludes(pGenCppClassFileWriter, parameterTypes);
- this.generateIncludes(pGenCppClassFileWriter, method.getReturnType());
+ this.generateIncludes(pProxyCppClassFileWriter, parameterTypes);
+ this.generateIncludes(pProxyCppClassFileWriter, method.getReturnType());
} else {
throw new IllegalArgumentException();
}
}
- protected void generateImports(final GenJavaClassFileWriter pGenJavaClassFileWriter, final Class<?> ... pTypes) {
+ protected void generateImports(final ProxyJavaClassFileWriter pProxyJavaClassFileWriter, final Class<?> ... pTypes) {
for(final Class<?> type : pTypes) {
if(!this.mUtil.isPrimitiveType(type)) {
final String genJavaImportClassName = this.mUtil.getGenJavaClassImport(type);
- pGenJavaClassFileWriter.append(GenJavaClassSourceFileSegment.IMPORTS, genJavaImportClassName).end();
+ pProxyJavaClassFileWriter.append(ProxyJavaClassSourceFileSegment.IMPORTS, genJavaImportClassName).end();
}
}
}
- protected void generateIncludes(final GenCppClassFileWriter pGenCppClassFileWriter, final Class<?> ... pTypes) {
+ protected void generateIncludes(final ProxyCppClassFileWriter pProxyCppClassFileWriter, final Class<?> ... pTypes) {
for(final Class<?> type : pTypes) {
if(!this.mUtil.isPrimitiveType(type)) {
final String genCppIncludeClassName = this.mUtil.getGenCppClassInclude(type);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, genCppIncludeClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, genCppIncludeClassName).end();
}
}
}
View
72 src/org/andengine/extension/scripting/generator/InterfaceGenerator.java
@@ -6,8 +6,8 @@
import org.andengine.extension.scripting.generator.util.Util;
import org.andengine.extension.scripting.generator.util.adt.CppFormatter;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter.GenCppClassHeaderFileSegment;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter.ProxyCppClassHeaderFileSegment;
/**
* (c) Zynga 2012
@@ -51,82 +51,82 @@ public InterfaceGenerator(final File pProxyCppRoot, final CppFormatter pGenCppFo
// ===========================================================
public void generateInterfaceCode(final Class<?> pClass) throws IOException {
- final GenCppClassFileWriter genCppClassFileWriter = new GenCppClassFileWriter(this.mProxyCppRoot, pClass, this.mUtil, this.mGenCppFormatter, true);
- genCppClassFileWriter.begin();
+ final ProxyCppClassFileWriter proxyCppClassFileWriter = new ProxyCppClassFileWriter(this.mProxyCppRoot, pClass, this.mUtil, this.mGenCppFormatter, true);
+ proxyCppClassFileWriter.begin();
- this.generateInterfaceHeader(pClass, genCppClassFileWriter);
- this.generateInterfaceMethods(pClass, genCppClassFileWriter);
- this.generateInterfaceFooter(pClass, genCppClassFileWriter);
+ this.generateInterfaceHeader(pClass, proxyCppClassFileWriter);
+ this.generateInterfaceMethods(pClass, proxyCppClassFileWriter);
+ this.generateInterfaceFooter(pClass, proxyCppClassFileWriter);
- genCppClassFileWriter.end();
+ proxyCppClassFileWriter.end();
}
- private void generateInterfaceHeader(final Class<?> pClass, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateInterfaceHeader(final Class<?> pClass, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
final String genCppClassName = this.mUtil.getGenCppClassName(pClass);
/* Generate native header. */
{
/* Header. */
{
/* #ifdef. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#ifndef %s_H", genCppClassName).end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#define %s_H", genCppClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#ifndef %s_H", genCppClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_IFDEF_HEAD, "#define %s_H", genCppClassName).end();
/* Imports. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, "#include <memory>").end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.INCLUDES, "#include <jni.h>").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, "#include <memory>").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.INCLUDES, "#include <jni.h>").end();
/* Class. */
final Class<?>[] interfaces = pClass.getInterfaces();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, "class %s", genCppClassName);
- this.generateIncludes(pGenCppClassFileWriter, interfaces);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, "class %s", genCppClassName);
+ this.generateIncludes(pProxyCppClassFileWriter, interfaces);
if(interfaces.length > 0) {
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, " : ");
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, " : ");
for(int i = 0; i < interfaces.length; i++) {
if(i > 0) {
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, ", ");
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, ", ");
}
final Class<?> interfaze = interfaces[i];
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, "public %s", this.mUtil.getGenCppClassName(interfaze));
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, "public %s", this.mUtil.getGenCppClassName(interfaze));
}
}
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_START, " {").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_START, " {").end();
/* Methods. */
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.METHODS_PUBLIC);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "public:").end();
- pGenCppClassFileWriter.incrementIndent(GenCppClassHeaderFileSegment.METHODS_PUBLIC);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual ~%s() { };", genCppClassName).end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual jobject unwrap() = 0;").end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "public:").end();
+ pProxyCppClassFileWriter.incrementIndent(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC);
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual ~%s() { };", genCppClassName).end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual jobject unwrap() = 0;").end();
}
}
}
- private void generateInterfaceMethods(final Class<?> pClass, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateInterfaceMethods(final Class<?> pClass, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
for(final Method method : pClass.getMethods()) {
if(this.mUtil.isGenMethodIncluded(method)) {
final String methodName = method.getName();
if(methodName.startsWith("on")) {
- this.generateIncludes(pGenCppClassFileWriter, method.getParameterTypes());
- this.generateInterfaceCallback(pClass, method, pGenCppClassFileWriter);
+ this.generateIncludes(pProxyCppClassFileWriter, method.getParameterTypes());
+ this.generateInterfaceCallback(pClass, method, pProxyCppClassFileWriter);
} else {
- this.generateIncludes(pGenCppClassFileWriter, method);
- this.generateInterfaceMethod(pClass, method, pGenCppClassFileWriter);
+ this.generateIncludes(pProxyCppClassFileWriter, method);
+ this.generateInterfaceMethod(pClass, method, pProxyCppClassFileWriter);
}
}
}
}
- private void generateInterfaceMethod(final Class<?> pClass, final Method pMethod, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateInterfaceMethod(final Class<?> pClass, final Method pMethod, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
final String genCppMethodHeaderParamatersAsString = this.mUtil.getGenCppMethodHeaderParamatersAsString(pMethod);
final String methodName = pMethod.getName();
final String returnTypeName = this.mUtil.getGenCppParameterTypeName(pMethod.getReturnType(), true);
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual %s %s(%s) = 0;", returnTypeName, methodName, (genCppMethodHeaderParamatersAsString != null) ? genCppMethodHeaderParamatersAsString : "").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual %s %s(%s) = 0;", returnTypeName, methodName, (genCppMethodHeaderParamatersAsString != null) ? genCppMethodHeaderParamatersAsString : "").end();
}
- private void generateInterfaceCallback(final Class<?> pClass, final Method pMethod, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateInterfaceCallback(final Class<?> pClass, final Method pMethod, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
final String genCppMethodHeaderParamatersAsString = this.mUtil.getGenCppMethodHeaderParamatersAsString(pMethod);
final String methodName = pMethod.getName();
@@ -137,15 +137,15 @@ private void generateInterfaceCallback(final Class<?> pClass, final Method pMeth
returnTypeName = this.mUtil.getGenCppParameterTypeName(pMethod.getReturnType(), true);
}
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual %s %s(%s) = 0;", returnTypeName, methodName, (genCppMethodHeaderParamatersAsString != null) ? genCppMethodHeaderParamatersAsString : "");
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.METHODS_PUBLIC, "virtual %s %s(%s) = 0;", returnTypeName, methodName, (genCppMethodHeaderParamatersAsString != null) ? genCppMethodHeaderParamatersAsString : "");
}
- private void generateInterfaceFooter(final Class<?> pClass, final GenCppClassFileWriter pGenCppClassFileWriter) {
+ private void generateInterfaceFooter(final Class<?> pClass, final ProxyCppClassFileWriter pProxyCppClassFileWriter) {
/* Generate native footer. */
{
/* Class. */
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_END, "};").end();
- pGenCppClassFileWriter.append(GenCppClassHeaderFileSegment.CLASS_END, "#endif").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_END, "};").end();
+ pProxyCppClassFileWriter.append(ProxyCppClassHeaderFileSegment.CLASS_END, "#endif").end();
}
}
View
8 src/org/andengine/extension/scripting/generator/util/Util.java
@@ -7,7 +7,7 @@
import java.lang.reflect.Modifier;
import java.util.List;
-import org.andengine.extension.scripting.generator.util.adt.io.GenCppClassFileWriter.GenCppClassHeaderFileSegment;
+import org.andengine.extension.scripting.generator.util.adt.io.ProxyCppClassFileWriter.ProxyCppClassHeaderFileSegment;
import com.thoughtworks.paranamer.BytecodeReadingParanamer;
@@ -425,11 +425,11 @@ public String getGenCppStaticMethodIDFieldName(final Constructor<?> pConstructor
return signatureBuilder.toString();
}
- public GenCppClassHeaderFileSegment getGenCppClassHeaderFileSegmentByVisibilityModifier(final int modifiers) {
+ public ProxyCppClassHeaderFileSegment getGenCppClassHeaderFileSegmentByVisibilityModifier(final int modifiers) {
if(Modifier.isPublic(modifiers)) {
- return GenCppClassHeaderFileSegment.METHODS_PUBLIC;
+ return ProxyCppClassHeaderFileSegment.METHODS_PUBLIC;
} else if(Modifier.isProtected(modifiers)) {
- return GenCppClassHeaderFileSegment.METHODS_PROTECTED;
+ return ProxyCppClassHeaderFileSegment.METHODS_PROTECTED;
} else {
throw new IllegalArgumentException();
}
View
8 .../generator/util/adt/io/GenCppClassFileWriter.java → ...tor/util/adt/io/JavaScriptCppClassFileWriter.java
@@ -11,9 +11,9 @@
* (c) Zynga 2012
*
* @author Nicolas Gramlich <ngramlich@zynga.com>
- * @since 15:02:38 - 21.03.2012
+ * @since 14:27:32 - 10.04.2012
*/
-public class GenCppClassFileWriter {
+public class JavaScriptCppClassFileWriter {
// ===========================================================
// Constants
// ===========================================================
@@ -29,11 +29,11 @@
// Constructors
// ===========================================================
- public GenCppClassFileWriter(final File pProxyCppRoot, final Class<?> pClass, final Util pUtil, final CppFormatter pCppFormatter) {
+ public JavaScriptCppClassFileWriter(final File pProxyCppRoot, final Class<?> pClass, final Util pUtil, final CppFormatter pCppFormatter) {
this(pProxyCppRoot, pClass, pUtil, pCppFormatter, false);
}
- public GenCppClassFileWriter(final File pProxyCppRoot, final Class<?> pClass, final Util pUtil, final CppFormatter pCppFormatter, final boolean pHeaderFileOnly) {
+ public JavaScriptCppClassFileWriter(final File pProxyCppRoot, final Class<?> pClass, final Util pUtil, final CppFormatter pCppFormatter, final boolean pHeaderFileOnly) {
if(pHeaderFileOnly) {
this.mGenCppClassSourceFileWriter = null;
} else {
View
198 src/org/andengine/extension/scripting/generator/util/adt/io/ProxyCppClassFileWriter.java
@@ -0,0 +1,198 @@
+package org.andengine.extension.scripting.generator.util.adt.io;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.andengine.extension.scripting.generator.util.Util;
+import org.andengine.extension.scripting.generator.util.adt.CppFormatter;
+import org.andengine.extension.scripting.generator.util.adt.io.GenFileWriter.GenFileWriterSegment;
+
+/**
+ * (c) Zynga 2012
+ *
+ * @author Nicolas Gramlich <ngramlich@zynga.com>
+ * @since 15:02:38 - 21.03.2012
+ */
+public class ProxyCppClassFileWriter {
+ // ===========================================================
+ // Constants
+ // ===========================================================
+
+ // ===========================================================
+ // Fields
+ // ===========================================================
+
+ private final GenFileWriter<ProxyCppClassSourceFileSegment> mGenCppClassSourceFileWriter;
+ private final GenFileWriter<ProxyCppClassHeaderFileSegment> mGenCppClassHeaderFileWriter;
+
+ // ===========================================================
+ // Constructors
+ // ===========================================================
+
+ public ProxyCppClassFileWriter(final File pProxyCppRoot, final Class<?> pClass, final Util pUtil, final CppFormatter pCppFormatter) {
+ this(pProxyCppRoot, pClass, pUtil, pCppFormatter, false);
+ }
+
+ public ProxyCppClassFileWriter(final File pProxyCppRoot, final Class<?> pClass, final Util pUtil, final CppFormatter pCppFormatter, final boolean pHeaderFileOnly) {
+ if(pHeaderFileOnly) {
+ this.mGenCppClassSourceFileWriter = null;
+ } else {
+ this.mGenCppClassSourceFileWriter = new GenFileWriter<ProxyCppClassSourceFileSegment>(pUtil.getGenCppClassSourceFile(pProxyCppRoot, pClass), pCppFormatter);
+ }
+ this.mGenCppClassHeaderFileWriter = new GenFileWriter<ProxyCppClassHeaderFileSegment>(pUtil.getGenCppClassHeaderFile(pProxyCppRoot, pClass), pCppFormatter);
+ }
+
+ // ===========================================================
+ // Getter & Setter
+ // ===========================================================
+
+ // ===========================================================
+ // Methods for/from SuperClass/Interfaces
+ // ===========================================================
+
+ // ===========================================================
+ // Methods
+ // ===========================================================
+
+ public void begin() throws IOException {
+ if(this.mGenCppClassSourceFileWriter != null) {
+ this.mGenCppClassSourceFileWriter.begin();
+ }
+ this.mGenCppClassHeaderFileWriter.begin();
+ }
+
+ public void end() throws IOException {
+ if(this.mGenCppClassSourceFileWriter != null) {
+ this.mGenCppClassSourceFileWriter.end();
+ }
+ this.mGenCppClassHeaderFileWriter.end();
+ }
+
+ public GenFileWriterSegment append(final ProxyCppClassSourceFileSegment pProxyCppClassSourceFileSegment, final String pString) {
+ return this.mGenCppClassSourceFileWriter.append(pProxyCppClassSourceFileSegment, pString);
+ }
+
+ public GenFileWriterSegment append(final ProxyCppClassSourceFileSegment pProxyCppClassSourceFileSegment, final String pString, final Object ... pArguments) {
+ return this.mGenCppClassSourceFileWriter.append(pProxyCppClassSourceFileSegment, pString, pArguments);
+ }
+
+ public GenFileWriterSegment endLine(final ProxyCppClassSourceFileSegment pProxyCppClassSourceFileSegment) {
+ return this.mGenCppClassSourceFileWriter.endLine(pProxyCppClassSourceFileSegment);
+ }
+
+ public GenFileWriterSegment append(final ProxyCppClassHeaderFileSegment pProxyCppClassHeaderFileSegment, final String pString) {
+ return this.mGenCppClassHeaderFileWriter.append(pProxyCppClassHeaderFileSegment, pString);
+ }
+
+ public GenFileWriterSegment append(final ProxyCppClassHeaderFileSegment pProxyCppClassHeaderFileSegment, final String pString, final Object ... pArguments) {
+ return this.mGenCppClassHeaderFileWriter.append(pProxyCppClassHeaderFileSegment, pString, pArguments);
+ }
+
+ public GenFileWriterSegment endLine(final ProxyCppClassHeaderFileSegment pProxyCppClassHeaderFileSegment) {
+ return this.mGenCppClassHeaderFileWriter.endLine(pProxyCppClassHeaderFileSegment);
+ }
+
+ public GenFileWriterSegment incrementIndent(final ProxyCppClassHeaderFileSegment pProxyCppClassHeaderFileSegment) {
+ return this.mGenCppClassHeaderFileWriter.incrementIndent(pProxyCppClassHeaderFileSegment);
+ }
+
+ public GenFileWriterSegment incrementIndent(final ProxyCppClassSourceFileSegment pProxyCppClassSourceFileSegment) {
+ return this.mGenCppClassSourceFileWriter.incrementIndent(pProxyCppClassSourceFileSegment);
+ }
+
+ public GenFileWriterSegment decrementIndent(final ProxyCppClassHeaderFileSegment pProxyCppClassHeaderFileSegment) {
+ return this.mGenCppClassHeaderFileWriter.decrementIndent(pProxyCppClassHeaderFileSegment);
+ }
+
+ public GenFileWriterSegment decrementIndent(final ProxyCppClassSourceFileSegment pProxyCppClassSourceFileSegment) {
+ return this.mGenCppClassSourceFileWriter.decrementIndent(pProxyCppClassSourceFileSegment);
+ }
+
+ // ===========================================================
+ // Inner and Anonymous Classes
+ // ===========================================================
+
+ public static enum ProxyCppClassSourceFileSegment {
+ // ===========================================================
+ // Elements
+ // ===========================================================
+
+ INCLUDES,
+ STATICS,
+ CLASS_INIT,
+ JNI_EXPORTS,
+ METHODS;
+
+ // ===========================================================
+ // Constants
+ // ===========================================================
+
+ // ===========================================================
+ // Fields
+ // ===========================================================
+
+ // ===========================================================
+ // Constructors
+ // ===========================================================
+
+ // ===========================================================
+ // Getter & Setter
+ // ===========================================================
+
+ // ===========================================================
+ // Methods for/from SuperClass/Interfaces
+ // ===========================================================
+
+ // ===========================================================
+ // Methods
+ // ===========================================================
+
+ // ===========================================================
+ // Inner and Anonymous Classes
+ // ===========================================================
+ }
+
+ public static enum ProxyCppClassHeaderFileSegment {
+ // ===========================================================
+ // Elements
+ // ===========================================================
+
+ CLASS_IFDEF_HEAD,
+ INCLUDES,
+ EXTERNS,
+ CLASS_START,
+ METHODS_PUBLIC,
+ METHODS_PROTECTED,
+ METHODS_PRIVATE,
+ CLASS_END,
+ CLASS_IFDEF_FOOT;
+
+ // ===========================================================
+ // Constants
+ // ===========================================================
+
+ // ===========================================================
+ // Fields
+ // ===========================================================
+
+ // ===========================================================
+ // Constructors
+ // ===========================================================
+
+ // ===========================================================
+ // Getter & Setter
+ // ===========================================================
+
+ // ===========================================================
+ // Methods for/from SuperClass/Interfaces
+ // ===========================================================
+
+ // ===========================================================
+ // Methods
+ // ===========================================================
+
+ // ===========================================================
+ // Inner and Anonymous Classes
+ // ===========================================================
+ }
+}
View
30 ...generator/util/adt/io/GenJavaClassFileWriter.java → ...nerator/util/adt/io/ProxyJavaClassFileWriter.java
@@ -13,7 +13,7 @@
* @author Nicolas Gramlich <ngramlich@zynga.com>
* @since 15:02:38 - 21.03.2012
*/
-public class GenJavaClassFileWriter {
+public class ProxyJavaClassFileWriter {
// ===========================================================
// Constants
// ===========================================================
@@ -22,14 +22,14 @@
// Fields
// ===========================================================
- private final GenFileWriter<GenJavaClassSourceFileSegment> mGenJavaClassSourceFileWriter;
+ private final GenFileWriter<ProxyJavaClassSourceFileSegment> mGenJavaClassSourceFileWriter;
// ===========================================================
// Constructors
// ===========================================================
- public GenJavaClassFileWriter(final File pProxyJavaRoot, final Class<?> pClass, final Util pUtil, final JavaFormatter pJavaFormatter) {
- this.mGenJavaClassSourceFileWriter = new GenFileWriter<GenJavaClassSourceFileSegment>(pUtil.getGenJavaClassSourceFile(pProxyJavaRoot, pClass), pJavaFormatter);
+ public ProxyJavaClassFileWriter(final File pProxyJavaRoot, final Class<?> pClass, final Util pUtil, final JavaFormatter pJavaFormatter) {
+ this.mGenJavaClassSourceFileWriter = new GenFileWriter<ProxyJavaClassSourceFileSegment>(pUtil.getGenJavaClassSourceFile(pProxyJavaRoot, pClass), pJavaFormatter);
}
// ===========================================================
@@ -52,31 +52,31 @@ public void end() throws IOException {
this.mGenJavaClassSourceFileWriter.end();
}
- public GenFileWriterSegment append(final GenJavaClassSourceFileSegment pGenJavaClassSourceFileSegment, final String pString) {
- return this.mGenJavaClassSourceFileWriter.append(pGenJavaClassSourceFileSegment, pString);
+ public GenFileWriterSegment append(final ProxyJavaClassSourceFileSegment pProxyJavaClassSourceFileSegment, final String pString) {
+ return this.mGenJavaClassSourceFileWriter.append(pProxyJavaClassSourceFileSegment, pString);
}
- public GenFileWriterSegment append(final GenJavaClassSourceFileSegment pGenJavaClassSourceFileSegment, final String pString, final Object ... pArguments) {
- return this.mGenJavaClassSourceFileWriter.append(pGenJavaClassSourceFileSegment, pString, pArguments);
+ public GenFileWriterSegment append(final ProxyJavaClassSourceFileSegment pProxyJavaClassSourceFileSegment, final String pString, final Object ... pArguments) {
+ return this.mGenJavaClassSourceFileWriter.append(pProxyJavaClassSourceFileSegment, pString, pArguments);
}
- public GenFileWriterSegment endLine(final GenJavaClassSourceFileSegment pGenJavaClassSourceFileSegment) {
- return this.mGenJavaClassSourceFileWriter.endLine(pGenJavaClassSourceFileSegment);
+ public GenFileWriterSegment endLine(final ProxyJavaClassSourceFileSegment pProxyJavaClassSourceFileSegment) {
+ return this.mGenJavaClassSourceFileWriter.endLine(pProxyJavaClassSourceFileSegment);
}
- public GenFileWriterSegment incrementIndent(final GenJavaClassSourceFileSegment pGenJavaClassSourceFileSegment) {
- return this.mGenJavaClassSourceFileWriter.incrementIndent(pGenJavaClassSourceFileSegment);
+ public GenFileWriterSegment incrementIndent(final ProxyJavaClassSourceFileSegment pProxyJavaClassSourceFileSegment) {
+ return this.mGenJavaClassSourceFileWriter.incrementIndent(pProxyJavaClassSourceFileSegment);
}
- public GenFileWriterSegment decrementIndent(final GenJavaClassSourceFileSegment pGenJavaClassSourceFileSegment) {
- return this.mGenJavaClassSourceFileWriter.decrementIndent(pGenJavaClassSourceFileSegment);
+ public GenFileWriterSegment decrementIndent(final ProxyJavaClassSourceFileSegment pProxyJavaClassSourceFileSegment) {
+ return this.mGenJavaClassSourceFileWriter.decrementIndent(pProxyJavaClassSourceFileSegment);
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
- public static enum GenJavaClassSourceFileSegment {
+ public static enum ProxyJavaClassSourceFileSegment {
// ===========================================================
// Elements
// ===========================================================
Please sign in to comment.
Something went wrong with that request. Please try again.