private boolean isInstance(Class< ? > type, String string) { if (type == null) return false; if (type.getName().equals(string)) return true; if (isInstance(type.getSuperclass(), string)) return true; for (Class< ? > intf : type.getInterfaces()) { if (isInstance(intf, string)) return true; } return false; }
private boolean isInstance(Class< ? > type, String string) { if (type == null) return false; if (type.getName().equals(string)) return true; if (isInstance(type.getSuperclass(), string)) return true; for (Class< ? > intf : type.getInterfaces()) { if (isInstance(intf, string)) return true; } return false; }
private boolean isInstance(Class< ? > type, String string) { if (type == null) return false; if (type.getName().equals(string)) return true; if (isInstance(type.getSuperclass(), string)) return true; for (Class< ? > intf : type.getInterfaces()) { if (isInstance(intf, string)) return true; } return false; }
private boolean isInstance(Class<?> type, String string) { if ( type == null) return false; if ( type.getName().equals(string)) return true; if ( isInstance( type.getSuperclass(), string)) return true; for ( Class<?> intf : type.getInterfaces()) { if ( isInstance(intf,string)) return true; } return false; }
/** * Verify that the type is an interface. * * @param type * the type to check. * @return true if this is a class that is an interface or a Parameterized * Type that is an interface * @throws Exception */ private boolean isInterface(Object type) throws Exception { if (type instanceof Class) return (((Class< ? >) type).isInterface()); if (isInstance(type.getClass(), "java.lang.reflect.ParameterizedType")) return isInterface(call(type, "getRawType")); return false; }
/** * Verify that the type is an interface. * * @param type the type to check. * @return true if this is a class that is an interface or a Parameterized * Type that is an interface * @throws Exception */ private boolean isInterface(Object type) throws Exception { if (type instanceof Class) return (((Class< ? >) type).isInterface()); if ( isInstance(type.getClass(), "java.lang.reflect.ParameterizedType")) return isInterface(call(type,"getRawType")); return false; }
/** * Verify that the type is an interface. * * @param type * the type to check. * @return true if this is a class that is an interface or a Parameterized * Type that is an interface * @throws Exception */ private boolean isInterface(Object type) throws Exception { if (type instanceof Class) return (((Class< ? >) type).isInterface()); if (isInstance(type.getClass(), "java.lang.reflect.ParameterizedType")) return isInterface(call(type, "getRawType")); return false; }
/** * Verify that the type is an interface. * * @param type * the type to check. * @return true if this is a class that is an interface or a Parameterized * Type that is an interface * @throws Exception */ private boolean isInterface(Object type) throws Exception { if (type instanceof Class) return (((Class< ? >) type).isInterface()); if (isInstance(type.getClass(), "java.lang.reflect.ParameterizedType")) return isInterface(call(type, "getRawType")); return false; }
/** * Creates the signature for a Parameterized Type. A Parameterized Type has * a raw class and a set of type variables. * * @param sb * @param pt * @throws Exception */ private void parameterizedType(StringBuilder sb, Object pt) throws Exception { Object owner = call(pt, "getOwnerType"); String name = ((Class< ? >) call(pt, "getRawType")).getName().replace('.', '/'); if (owner != null) { if (isInstance(owner.getClass(), "java.lang.reflect.ParameterizedType")) parameterizedType(sb, owner); else sb.append(((Class< ? >) owner).getName().replace('.', '/')); sb.append('.'); int n = name.lastIndexOf('$'); name = name.substring(n + 1); } sb.append(name); sb.append('<'); for (Object parameterType : (Object[]) call(pt, "getActualTypeArguments")) { reference(sb, parameterType); } sb.append('>'); }
/** * Creates the signature for a Parameterized Type. A Parameterized Type has * a raw class and a set of type variables. * * @param sb * @param pt * @throws Exception */ private void parameterizedType(StringBuilder sb, Object pt) throws Exception { Object owner = call(pt, "getOwnerType"); String name = ((Class< ? >) call(pt, "getRawType")).getName().replace('.', '/'); if (owner != null) { if (isInstance(owner.getClass(), "java.lang.reflect.ParameterizedType")) parameterizedType(sb, owner); else sb.append(((Class< ? >) owner).getName().replace('.', '/')); sb.append('.'); int n = name.lastIndexOf('$'); name = name.substring(n + 1); } sb.append(name); sb.append('<'); for (Object parameterType : (Object[]) call(pt, "getActualTypeArguments")) { reference(sb, parameterType); } sb.append('>'); }
/** * Creates the signature for a Parameterized Type. A Parameterized Type has * a raw class and a set of type variables. * * @param sb * @param pt * @throws Exception */ private void parameterizedType(StringBuilder sb, Object pt) throws Exception { Object owner = call(pt, "getOwnerType"); String name = ((Class< ? >) call(pt, "getRawType")).getName().replace('.', '/'); if (owner != null) { if (isInstance(owner.getClass(), "java.lang.reflect.ParameterizedType")) parameterizedType(sb, owner); else sb.append(((Class< ? >) owner).getName().replace('.', '/')); sb.append('.'); int n = name.lastIndexOf('$'); name = name.substring(n + 1); } sb.append(name); sb.append('<'); for (Object parameterType : (Object[]) call(pt, "getActualTypeArguments")) { reference(sb, parameterType); } sb.append('>'); }
/** * Creates the signature for a Parameterized Type. * * A Parameterized Type has a raw class and a set of type variables. * * @param sb * @param pt * @throws Exception */ private void parameterizedType(StringBuffer sb, Object pt) throws Exception { Object owner = call(pt,"getOwnerType"); String name = ((Class< ? >) call(pt,"getRawType")).getName() .replace('.', '/'); if (owner != null) { if ( isInstance(owner.getClass(), "java.lang.reflect.ParameterizedType")) parameterizedType(sb, owner); else sb.append(((Class< ? >) owner).getName().replace('.', '/')); sb.append('.'); int n = name.lastIndexOf('$'); name = name.substring(n + 1); } sb.append(name); sb.append('<'); for (Object parameterType : (Object[]) call(pt,"getActualTypeArguments")) { reference(sb, parameterType); } sb.append('>'); }
if (isInstance(t.getClass(), "java.lang.reflect.ParameterizedType")) { sb.append('L'); parameterizedType(sb, t); sb.append(';'); return; } else if (isInstance(t.getClass(), "java.lang.reflect.GenericArrayType")) { sb.append('['); reference(sb, call(t, "getGenericComponentType")); } else if (isInstance(t.getClass(), "java.lang.reflect.WildcardType")) { Object[] lowerBounds = (Object[]) call(t, "getLowerBounds"); Object[] upperBounds = (Object[]) call(t, "getUpperBounds"); } else if (isInstance(t.getClass(), "java.lang.reflect.TypeVariable")) { sb.append('T'); sb.append(call(t, "getName"));
if (isInstance(t.getClass(), "java.lang.reflect.ParameterizedType")) { sb.append('L'); parameterizedType(sb, t); sb.append(';'); return; } else if (isInstance(t.getClass(), "java.lang.reflect.GenericArrayType")) { sb.append('['); reference(sb, call(t, "getGenericComponentType")); } else if (isInstance(t.getClass(), "java.lang.reflect.WildcardType")) { Object[] lowerBounds = (Object[]) call(t, "getLowerBounds"); Object[] upperBounds = (Object[]) call(t, "getUpperBounds"); } else if (isInstance(t.getClass(), "java.lang.reflect.TypeVariable")) { sb.append('T'); sb.append(call(t, "getName"));
if (isInstance(t.getClass(), "java.lang.reflect.ParameterizedType")) { sb.append('L'); parameterizedType(sb, t); sb.append(';'); return; } else if (isInstance(t.getClass(), "java.lang.reflect.GenericArrayType")) { sb.append('['); reference(sb, call(t, "getGenericComponentType")); } else if (isInstance(t.getClass(), "java.lang.reflect.WildcardType")) { Object[] lowerBounds = (Object[]) call(t, "getLowerBounds"); Object[] upperBounds = (Object[]) call(t, "getUpperBounds"); } else if (isInstance(t.getClass(), "java.lang.reflect.TypeVariable")) { sb.append('T'); sb.append(call(t, "getName"));
if ( isInstance(t.getClass(),"java.lang.reflect.ParameterizedType")) { sb.append('L'); parameterizedType(sb, t); if ( isInstance(t.getClass(), "java.lang.reflect.GenericArrayType")) { sb.append('['); reference(sb, call(t,"getGenericComponentType")); if ( isInstance(t.getClass(), "java.lang.reflect.WildcardType")) { Object[] lowerBounds = (Object[]) call(t, "getLowerBounds"); Object[] upperBounds = (Object[]) call(t, "getUpperBounds"); if ( isInstance(t.getClass(),"java.lang.reflect.TypeVariable")) { sb.append('T'); sb.append( call(t,"getName"));