/** * {@inheritDoc} * * <p>{@code [<E>]} will be returned for ArrayList's constructor. When both the class and the * constructor have type parameters, the class parameters are prepended before those of the * constructor's. This is an arbitrary rule since no existing language spec mandates one way or * the other. From the declaration syntax, the class type parameter appears first, but the call * syntax may show up in opposite order such as {@code new <A>Foo<B>()}. */ @Override public final TypeVariable<?>[] getTypeParameters() { TypeVariable<?>[] declaredByClass = getDeclaringClass().getTypeParameters(); TypeVariable<?>[] declaredByConstructor = constructor.getTypeParameters(); TypeVariable<?>[] result = new TypeVariable<?>[declaredByClass.length + declaredByConstructor.length]; System.arraycopy(declaredByClass, 0, result, 0, declaredByClass.length); System.arraycopy( declaredByConstructor, 0, result, declaredByClass.length, declaredByConstructor.length); return result; }
@Override Type[] getGenericParameterTypes() { Type[] types = constructor.getGenericParameterTypes(); if (types.length > 0 && mayNeedHiddenThis()) { Class<?>[] rawParamTypes = constructor.getParameterTypes(); if (types.length == rawParamTypes.length && rawParamTypes[0] == getDeclaringClass().getEnclosingClass()) { // first parameter is the hidden 'this' return Arrays.copyOfRange(types, 1, types.length); } } return types; }
/** * {@inheritDoc} * * {@code [<E>]} will be returned for ArrayList's constructor. When both the class and the * constructor have type parameters, the class parameters are prepended before those of the * constructor's. This is an arbitrary rule since no existing language spec mandates one way or * the other. From the declaration syntax, the class type parameter appears first, but the * call syntax may show up in opposite order such as {@code new <A>Foo<B>()}. */ @Override public final TypeVariable<?>[] getTypeParameters() { TypeVariable<?>[] declaredByClass = getDeclaringClass().getTypeParameters(); TypeVariable<?>[] declaredByConstructor = constructor.getTypeParameters(); TypeVariable<?>[] result = new TypeVariable<?>[declaredByClass.length + declaredByConstructor.length]; System.arraycopy(declaredByClass, 0, result, 0, declaredByClass.length); System.arraycopy( declaredByConstructor, 0, result, declaredByClass.length, declaredByConstructor.length); return result; }
/** * {@inheritDoc} * * {@code [<E>]} will be returned for ArrayList's constructor. When both the class and the * constructor have type parameters, the class parameters are prepended before those of the * constructor's. This is an arbitrary rule since no existing language spec mandates one way or * the other. From the declaration syntax, the class type parameter appears first, but the * call syntax may show up in opposite order such as {@code new <A>Foo<B>()}. */ @Override public final TypeVariable<?>[] getTypeParameters() { TypeVariable<?>[] declaredByClass = getDeclaringClass().getTypeParameters(); TypeVariable<?>[] declaredByConstructor = constructor.getTypeParameters(); TypeVariable<?>[] result = new TypeVariable<?>[declaredByClass.length + declaredByConstructor.length]; System.arraycopy(declaredByClass, 0, result, 0, declaredByClass.length); System.arraycopy( declaredByConstructor, 0, result, declaredByClass.length, declaredByConstructor.length); return result; }
/** * {@inheritDoc} * * {@code [<E>]} will be returned for ArrayList's constructor. When both the class and the * constructor have type parameters, the class parameters are prepended before those of the * constructor's. This is an arbitrary rule since no existing language spec mandates one way or * the other. From the declaration syntax, the class type parameter appears first, but the * call syntax may show up in opposite order such as {@code new <A>Foo<B>()}. */ @Override public final TypeVariable<?>[] getTypeParameters() { TypeVariable<?>[] declaredByClass = getDeclaringClass().getTypeParameters(); TypeVariable<?>[] declaredByConstructor = constructor.getTypeParameters(); TypeVariable<?>[] result = new TypeVariable<?>[declaredByClass.length + declaredByConstructor.length]; System.arraycopy(declaredByClass, 0, result, 0, declaredByClass.length); System.arraycopy( declaredByConstructor, 0, result, declaredByClass.length, declaredByConstructor.length); return result; }
/** * {@inheritDoc} * * {@code [<E>]} will be returned for ArrayList's constructor. When both the class and the * constructor have type parameters, the class parameters are prepended before those of the * constructor's. This is an arbitrary rule since no existing language spec mandates one way or * the other. From the declaration syntax, the class type parameter appears first, but the * call syntax may show up in opposite order such as {@code new <A>Foo<B>()}. */ @Override public final TypeVariable<?>[] getTypeParameters() { TypeVariable<?>[] declaredByClass = getDeclaringClass().getTypeParameters(); TypeVariable<?>[] declaredByConstructor = constructor.getTypeParameters(); TypeVariable<?>[] result = new TypeVariable<?>[declaredByClass.length + declaredByConstructor.length]; System.arraycopy(declaredByClass, 0, result, 0, declaredByClass.length); System.arraycopy( declaredByConstructor, 0, result, declaredByClass.length, declaredByConstructor.length); return result; }
/** * {@inheritDoc} * * {@code [<E>]} will be returned for ArrayList's constructor. When both the class and the * constructor have type parameters, the class parameters are prepended before those of the * constructor's. This is an arbitrary rule since no existing language spec mandates one way or * the other. From the declaration syntax, the class type parameter appears first, but the * call syntax may show up in opposite order such as {@code new <A>Foo<B>()}. */ @Override public final TypeVariable<?>[] getTypeParameters() { TypeVariable<?>[] declaredByClass = getDeclaringClass().getTypeParameters(); TypeVariable<?>[] declaredByConstructor = constructor.getTypeParameters(); TypeVariable<?>[] result = new TypeVariable<?>[declaredByClass.length + declaredByConstructor.length]; System.arraycopy(declaredByClass, 0, result, 0, declaredByClass.length); System.arraycopy( declaredByConstructor, 0, result, declaredByClass.length, declaredByConstructor.length); return result; }
/** * {@inheritDoc} * * <p>{@code [<E>]} will be returned for ArrayList's constructor. When both the class and the * constructor have type parameters, the class parameters are prepended before those of the * constructor's. This is an arbitrary rule since no existing language spec mandates one way or * the other. From the declaration syntax, the class type parameter appears first, but the call * syntax may show up in opposite order such as {@code new <A>Foo<B>()}. */ @Override public final TypeVariable<?>[] getTypeParameters() { TypeVariable<?>[] declaredByClass = getDeclaringClass().getTypeParameters(); TypeVariable<?>[] declaredByConstructor = constructor.getTypeParameters(); TypeVariable<?>[] result = new TypeVariable<?>[declaredByClass.length + declaredByConstructor.length]; System.arraycopy(declaredByClass, 0, result, 0, declaredByClass.length); System.arraycopy( declaredByConstructor, 0, result, declaredByClass.length, declaredByConstructor.length); return result; }
/** * {@inheritDoc} * * <p>{@code [<E>]} will be returned for ArrayList's constructor. When both the class and the * constructor have type parameters, the class parameters are prepended before those of the * constructor's. This is an arbitrary rule since no existing language spec mandates one way or * the other. From the declaration syntax, the class type parameter appears first, but the call * syntax may show up in opposite order such as {@code new <A>Foo<B>()}. */ @Override public final TypeVariable<?>[] getTypeParameters() { TypeVariable<?>[] declaredByClass = getDeclaringClass().getTypeParameters(); TypeVariable<?>[] declaredByConstructor = constructor.getTypeParameters(); TypeVariable<?>[] result = new TypeVariable<?>[declaredByClass.length + declaredByConstructor.length]; System.arraycopy(declaredByClass, 0, result, 0, declaredByClass.length); System.arraycopy( declaredByConstructor, 0, result, declaredByClass.length, declaredByConstructor.length); return result; }
/** * {@inheritDoc} * * {@code [<E>]} will be returned for ArrayList's constructor. When both the class and the * constructor have type parameters, the class parameters are prepended before those of the * constructor's. This is an arbitrary rule since no existing language spec mandates one way or * the other. From the declaration syntax, the class type parameter appears first, but the * call syntax may show up in opposite order such as {@code new <A>Foo<B>()}. */ @Override public final TypeVariable<?>[] getTypeParameters() { TypeVariable<?>[] declaredByClass = getDeclaringClass().getTypeParameters(); TypeVariable<?>[] declaredByConstructor = constructor.getTypeParameters(); TypeVariable<?>[] result = new TypeVariable<?>[declaredByClass.length + declaredByConstructor.length]; System.arraycopy(declaredByClass, 0, result, 0, declaredByClass.length); System.arraycopy( declaredByConstructor, 0, result, declaredByClass.length, declaredByConstructor.length); return result; }
/** * If the class is parameterized, such as {@link java.util.ArrayList ArrayList}, this returns * {@code ArrayList<E>}. */ @Override Type getGenericReturnType() { Class<?> declaringClass = getDeclaringClass(); TypeVariable<?>[] typeParams = declaringClass.getTypeParameters(); if (typeParams.length > 0) { return Types.newParameterizedType(declaringClass, typeParams); } else { return declaringClass; } }
/** * If the class is parameterized, such as {@link java.util.ArrayList ArrayList}, this returns * {@code ArrayList<E>}. */ @Override Type getGenericReturnType() { Class<?> declaringClass = getDeclaringClass(); TypeVariable<?>[] typeParams = declaringClass.getTypeParameters(); if (typeParams.length > 0) { return Types.newParameterizedType(declaringClass, typeParams); } else { return declaringClass; } }
/** Returns {@link Invokable} of {@code constructor}. */ public static <T> Invokable<T, T> from(Constructor<T> constructor) { return new ConstructorInvokable<T>(constructor); }
/** Returns {@link Invokable} of {@code constructor}. */ public static <T> Invokable<T, T> from(Constructor<T> constructor) { return new ConstructorInvokable<T>(constructor); }
/** Returns {@link Invokable} of {@code constructor}. */ public static <T> Invokable<T, T> from(Constructor<T> constructor) { return new ConstructorInvokable<T>(constructor); }
/** Returns {@link Invokable} of {@code constructor}. */ public static <T> Invokable<T, T> from(Constructor<T> constructor) { return new ConstructorInvokable<T>(constructor); }
/** Returns {@link Invokable} of {@code constructor}. */ public static <T> Invokable<T, T> from(Constructor<T> constructor) { return new ConstructorInvokable<T>(constructor); }
/** Returns {@link Invokable} of {@code constructor}. */ public static <T> Invokable<T, T> from(Constructor<T> constructor) { return new ConstructorInvokable<T>(constructor); }
/** Returns {@link Invokable} of {@code constructor}. */ public static <T> Invokable<T, T> from(Constructor<T> constructor) { return new ConstructorInvokable<T>(constructor); }
/** Returns {@link Invokable} of {@code constructor}. */ public static <T> Invokable<T, T> from(Constructor<T> constructor) { return new ConstructorInvokable<T>(constructor); }