diff options
Diffstat (limited to 'bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaData.java')
-rw-r--r-- | bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaData.java | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaData.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaData.java index d06e1fdc15..01d464b559 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaData.java +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaData.java @@ -12,8 +12,6 @@ package org.eclipse.swt.tools.internal; import java.io.IOException; import java.io.InputStream; -import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.util.Properties; public class MetaData { @@ -48,162 +46,10 @@ public MetaData(Properties data) { this.data = data; } -public ClassData getMetaData(Class clazz) { - String key = JNIGenerator.toC(clazz.getName()); - String value = getMetaData(key, ""); - return new ClassData(clazz, value); -} - -public FieldData getMetaData(Field field) { - String className = JNIGenerator.getClassName(field.getDeclaringClass()); - String key = className + "_" + field.getName(); - String value = getMetaData(key, ""); - return new FieldData(field, value); -} - -boolean convertTo32Bit(Class[] paramTypes, boolean floatingPointTypes) { - boolean changed = false; - for (int i = 0; i < paramTypes.length; i++) { - Class paramType = paramTypes[i]; - if (paramType == Long.TYPE) { - paramTypes[i] = Integer.TYPE; - changed = true; - } - if (paramType == long[].class) { - paramTypes[i] = int[].class; - changed = true; - } - if (floatingPointTypes) { - if (paramType == Double.TYPE) { - paramTypes[i] = Float.TYPE; - changed = true; - } - if (paramType == double[].class) { - paramTypes[i] = float[].class; - changed = true; - } - } - } - return changed; -} - -public MethodData getMetaData(Method method) { - String className = JNIGenerator.getClassName(method.getDeclaringClass()); - String key = className + "_" + JNIGenerator.getFunctionName(method); - String value = getMetaData(key, null); - if (value == null) { - key = className + "_" + method.getName(); - value = getMetaData(key, null); - } - /* - * Support for 64 bit port. - */ - if (value == null) { - Class[] paramTypes = method.getParameterTypes(); - if (convertTo32Bit(paramTypes, true)) { - key = className + "_" + JNIGenerator.getFunctionName(method, paramTypes); - value = getMetaData(key, null); - } - if (value == null) { - paramTypes = method.getParameterTypes(); - if (convertTo32Bit(paramTypes, false)) { - key = className + "_" + JNIGenerator.getFunctionName(method, paramTypes); - value = getMetaData(key, null); - } - } - } - /* - * Support for lock. - */ - if (value == null && method.getName().startsWith("_")) { - key = className + "_" + JNIGenerator.getFunctionName(method).substring(2); - value = getMetaData(key, null); - if (value == null) { - key = className + "_" + method.getName().substring(1); - value = getMetaData(key, null); - } - } - if (value == null) value = ""; - return new MethodData(method, value); -} - -public ParameterData getMetaData(Method method, int parameter) { - String className = JNIGenerator.getClassName(method.getDeclaringClass()); - String key = className + "_" + JNIGenerator.getFunctionName(method) + "_" + parameter; - String value = getMetaData(key, null); - if (value == null) { - key = className + "_" + method.getName() + "_" + parameter; - value = getMetaData(key, null); - } - /* - * Support for 64 bit port. - */ - if (value == null) { - Class[] paramTypes = method.getParameterTypes(); - if (convertTo32Bit(paramTypes, true)) { - key = className + "_" + JNIGenerator.getFunctionName(method, paramTypes) + "_" + parameter; - value = getMetaData(key, null); - } - if (value == null) { - paramTypes = method.getParameterTypes(); - if (convertTo32Bit(paramTypes, false)) { - key = className + "_" + JNIGenerator.getFunctionName(method, paramTypes) + "_" + parameter; - value = getMetaData(key, null); - } - } - } - /* - * Support for lock. - */ - if (value == null && method.getName().startsWith("_")) { - key = className + "_" + JNIGenerator.getFunctionName(method).substring(2) + "_" + parameter; - value = getMetaData(key, null); - if (value == null) { - key = className + "_" + method.getName().substring(1) + "_" + parameter; - value = getMetaData(key, null); - } - } - if (value == null) value = ""; - return new ParameterData(method, parameter, value); -} - public String getMetaData(String key, String defaultValue) { return data.getProperty(key, defaultValue); } -public void setMetaData(Class clazz, ClassData value) { - String key = JNIGenerator.toC(clazz.getName()); - setMetaData(key, value.toString()); -} - -public void setMetaData(Field field, FieldData value) { - String className = JNIGenerator.getClassName(field.getDeclaringClass()); - String key = className + "_" + field.getName(); - setMetaData(key, value.toString()); -} - -public void setMetaData(Method method, MethodData value) { - String key; - String className = JNIGenerator.getClassName(method.getDeclaringClass()); - if (JNIGenerator.isNativeUnique(method)) { - key = className + "_" + method.getName (); - } else { - key = className + "_" + JNIGenerator.getFunctionName(method); - } - setMetaData(key, value.toString()); -} - -public void setMetaData(Method method, int arg, ParameterData value) { - String key; - String className = JNIGenerator.getClassName(method.getDeclaringClass()); - if (JNIGenerator.isNativeUnique(method)) { - key = className + "_" + method.getName () + "_" + arg; - } else { - key = className + "_" + JNIGenerator.getFunctionName(method) + "_" + arg; - } - setMetaData(key, value.toString()); -} - public void setMetaData(String key, String value) { data.setProperty(key, value); } |