aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat/CompatUtils.java
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-03-23 23:18:49 -0700
committersatok <satok@google.com>2011-03-24 22:57:58 -0700
commitb2707856aba4fc9b063f26305f1fb603b19c1701 (patch)
tree259b45df34e8cce5e3b3ec01f742fa9741351969 /java/src/com/android/inputmethod/compat/CompatUtils.java
parent5a41db8814782a1eb15a1b095a4cd81ea2ca8daa (diff)
downloadlatinime-b2707856aba4fc9b063f26305f1fb603b19c1701.tar.gz
latinime-b2707856aba4fc9b063f26305f1fb603b19c1701.tar.xz
latinime-b2707856aba4fc9b063f26305f1fb603b19c1701.zip
Added InputConnectionCompatUtils and EditorInfoCompatUtils
Change-Id: Ie69d5e90c4ee978d3ecb40b68e6466082569ca7a
Diffstat (limited to 'java/src/com/android/inputmethod/compat/CompatUtils.java')
-rw-r--r--java/src/com/android/inputmethod/compat/CompatUtils.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/compat/CompatUtils.java b/java/src/com/android/inputmethod/compat/CompatUtils.java
index 07db4a1bb..a8086919c 100644
--- a/java/src/com/android/inputmethod/compat/CompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/CompatUtils.java
@@ -20,6 +20,7 @@ import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -90,6 +91,19 @@ public class CompatUtils {
}
}
+ public static Constructor<?> getConstructor(Class<?> targetClass, Class<?>[] types) {
+ if (targetClass == null || types == null) return null;
+ try {
+ return targetClass.getConstructor(types);
+ } catch (SecurityException e) {
+ // ignore
+ return null;
+ } catch (NoSuchMethodException e) {
+ // ignore
+ return null;
+ }
+ }
+
public static Object invoke(
Object receiver, Object defaultValue, Method method, Object... args) {
if (receiver == null || method == null) return defaultValue;