public Annotation[] getDeclaredAnnotations() { Annotation[] annotations= new Annotation[0]; Object[] maps= (Object[]) ScriptHelper.eval("this.$$$nativeClass___java_lang_Object.annotations", this); if (maps == null) return annotations; int i= 0; for (Object map : maps) { InvocationHandler handler= new AnnotationInvocationHandler2(new JSObject(map)); Annotation annotation= (Annotation) Proxy.newProxyInstance(null, new Class[] { null }, handler); annotations[i++]= annotation; } return annotations; }
public boolean containsKey(String propertyName) { return containsKey(ScriptHelper.eval("this.obj", null), propertyName); }
public Field getField(String name) throws NoSuchFieldException, SecurityException { Field foundField= foundFields.get(name); if (foundField == null) { Field[] declaredFields= getDeclaredFields(); for (Field method : declaredFields) if (method.getName().equals(name)) foundFields.put(name, foundField= method); } if (foundField == null) throw new NoSuchFieldException(getName() + "." + name); return foundField; }
public Method getMethod(String name, Class<?>... parameterTypes) throws NoSuchMethodException, SecurityException { String argumentTypesToString= argumentTypesToString(parameterTypes); String key= name + argumentTypesToString; Method foundMethod= foundMethods.get(key); if (foundMethod == null) { Method[] declaredMethods= getMethods(); for (Method method : declaredMethods) { if (method.getName().equals(name) && // arrayContentsEq(parameterTypes, method.getParameterTypes()) && // (foundMethod == null || foundMethod.getReturnType().isAssignableFrom(method.getReturnType()))) foundMethods.put(key, foundMethod= method); } } if (foundMethod == null) throw new NoSuchMethodException(getName() + "." + key); return foundMethod; }
public T get(String key) { ScriptHelper.put("key", key, null); if (containsKey(ScriptHelper.eval("this.obj", null), key)) { return (T) ScriptHelper.eval("this.obj[key]", null); } return null; }
Class<?> clazz= classesByName.get(className); if (clazz == null) ScriptHelper.put("className", className, null); ScriptHelper.eval("clazz.realName=className", null); classesByName.put(className, clazz); return clazz; ScriptHelper.put("className", className, null); ScriptHelper.eval("clazz.realName=className", null); classesByName.put(className, clazz);