/** * Check if the environment has generics, i.e. later than Java 5 VM. * * @return true if generics are supported * @throws Exception */ public boolean hasGenerics() throws Exception { try { call(Signatures.class, "getGenericSuperClass"); return true; } catch (NoSuchMethodException mnfe) { return false; } }
/** * Check if the environment has generics, i.e. later than * Java 5 VM. * * @return true if generics are supported * @throws Exception */ public boolean hasGenerics() throws Exception { try { call( Signatures.class, "getGenericSuperClass"); return true; } catch( NoSuchMethodException mnfe ) { return false; } }
/** * Check if the environment has generics, i.e. later than Java 5 VM. * * @return true if generics are supported * @throws Exception */ public boolean hasGenerics() throws Exception { try { call(Signatures.class, "getGenericSuperClass"); return true; } catch (NoSuchMethodException mnfe) { return false; } }
/** * Check if the environment has generics, i.e. later than Java 5 VM. * * @return true if generics are supported * @throws Exception */ public boolean hasGenerics() throws Exception { try { call(Signatures.class, "getGenericSuperClass"); return true; } catch (NoSuchMethodException mnfe) { return false; } }
/** * Calculate the generic signature of a Field. A Field consists of: * * <pre> * constructor ::= reference * </pre> * * @param c * @return * @throws Exception */ public String getSignature(Field f) throws Exception { StringBuilder sb = new StringBuilder(); Object t = call(f, "getGenericType"); reference(sb, t); return sb.toString(); }
/** * Calculate the generic signature of a Field. A Field consists of: * * <pre> * constructor ::= reference * </pre> * * @param c * @return * @throws Exception */ public String getSignature(Field f) throws Exception { StringBuffer sb = new StringBuffer(); Object t = call(f,"getGenericType"); reference(sb, t); return sb.toString(); }
/** * Calculate the generic signature of a Field. A Field consists of: * * <pre> * constructor ::= reference * </pre> * * @param c * @return * @throws Exception */ public String getSignature(Field f) throws Exception { StringBuilder sb = new StringBuilder(); Object t = call(f, "getGenericType"); reference(sb, t); return sb.toString(); }
/** * Calculate the generic signature of a Field. A Field consists of: * * <pre> * constructor ::= reference * </pre> * * @param c * @return * @throws Exception */ public String getSignature(Field f) throws Exception { StringBuilder sb = new StringBuilder(); Object t = call(f, "getGenericType"); reference(sb, t); return sb.toString(); }
/** * 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; }
/** * Calculate the generic signature of a Method. A Method consists of: * * <pre> * method ::= declaration? '(' reference* ')' reference * </pre> * * @param c * @return * @throws Exception */ public String getSignature(Method m) throws Exception { StringBuffer sb = new StringBuffer(); declaration(sb, m); sb.append('('); for (Object type : (Object[]) call(m,"getGenericParameterTypes")) { reference(sb, type); } sb.append(')'); reference(sb, call(m,"getGenericReturnType")); return sb.toString(); }
/** * 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; }
/** * Calculate the generic signature of a Method. A Method consists of: * * <pre> * method ::= declaration? '(' reference* ')' reference * </pre> * * @param c * @return * @throws Exception */ public String getSignature(Method m) throws Exception { StringBuilder sb = new StringBuilder(); declaration(sb, m); sb.append('('); for (Object type : (Object[]) call(m, "getGenericParameterTypes")) { reference(sb, type); } sb.append(')'); reference(sb, call(m, "getGenericReturnType")); return sb.toString(); }
/** * Calculate the generic signature of a Class. A Class consists of: * * <pre> * class ::= declaration? reference reference* * </pre> * * @param f * @return * @throws Exception */ public String getSignature(Class< ? > c) throws Exception { StringBuilder sb = new StringBuilder(); declaration(sb, c); reference(sb, call(c, "getGenericSuperclass")); for (Object type : (Object[]) call(c, "getGenericInterfaces")) { reference(sb, type); } return sb.toString(); }
/** * Calculate the generic signature of a Class. A Class consists of: * * <pre> * class ::= declaration? reference reference* * </pre> * * @param f * @return * @throws Exception */ public String getSignature(Class< ? > c) throws Exception { StringBuilder sb = new StringBuilder(); declaration(sb, c); reference(sb, call(c, "getGenericSuperclass")); for (Object type : (Object[]) call(c, "getGenericInterfaces")) { reference(sb, type); } return sb.toString(); }
/** * Calculate the generic signature of a Class. A Class consists of: * * <pre> * class ::= declaration? reference reference* * </pre> * * @param f * @return * @throws Exception */ public String getSignature(Class< ? > c) throws Exception { StringBuilder sb = new StringBuilder(); declaration(sb, c); reference(sb, call(c, "getGenericSuperclass")); for (Object type : (Object[]) call(c, "getGenericInterfaces")) { reference(sb, type); } return sb.toString(); }
/** * 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; }
/** * Calculate the generic signature of a Method. A Method consists of: * * <pre> * method ::= declaration? '(' reference* ')' reference * </pre> * * @param c * @return * @throws Exception */ public String getSignature(Method m) throws Exception { StringBuilder sb = new StringBuilder(); declaration(sb, m); sb.append('('); for (Object type : (Object[]) call(m, "getGenericParameterTypes")) { reference(sb, type); } sb.append(')'); reference(sb, call(m, "getGenericReturnType")); return sb.toString(); }
/** * Calculate the generic signature of a Class. A Class consists of: * * <pre> * class ::= declaration? reference reference* * </pre> * * * @param f * @return * @throws Exception */ public String getSignature(Class< ? > c) throws Exception { StringBuffer sb = new StringBuffer(); declaration(sb, c); reference(sb, call(c, "getGenericSuperclass")); for (Object type : (Object[]) call(c,"getGenericInterfaces")) { reference(sb, type); } return sb.toString(); }
/** * Calculate the generic signature of a Constructor. A Constructor consists * of: * * <pre> * constructor ::= declaration? '(' reference* ')V' * </pre> * * @param c * @return * @throws Exception */ public String getSignature(Constructor< ? > c) throws Exception { StringBuilder sb = new StringBuilder(); declaration(sb, c); sb.append('('); for (Object type : (Object[]) call(c, "getGenericParameterTypes")) { reference(sb, type); } sb.append(')'); reference(sb, void.class); return sb.toString(); }