Java Code Examples for java.lang.reflect.MalformedParameterizedTypeException

The following examples show how to use java.lang.reflect.MalformedParameterizedTypeException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private Class<? extends Throwable> getGenericType(Class<? extends ExceptionMapper> mapper) {
    try {
        Type[] types = mapper.getGenericInterfaces();
        if (null == types || 0 == types.length) {
            types = new Type[]{mapper.getGenericSuperclass()};
        }

        for (Type type : types) {
            Class<?> rawType = ClassUtils.getRawType(type);
            if (type instanceof ParameterizedType && ExceptionMapper.class.isAssignableFrom(rawType)) {
                //noinspection unchecked
                return (Class<? extends Throwable>) ((ParameterizedType) type).getActualTypeArguments()[0];
            }
        }

        if (isProxy(mapper)) {
            return getGenericType((Class<? extends ExceptionMapper>) mapper.getSuperclass());
        }

        //Won't get in here
        throw new IllegalStateException("unable to discover exception class for " + mapper.getName());
    } catch (MalformedParameterizedTypeException e) {
        throw new IllegalStateException(mapper.getName(), e);
    }
}
 
Example 2
Source Project: Bytecoder   Source File: ParameterizedTypeImpl.java    License: Apache License 2.0 6 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length) {
        throw new MalformedParameterizedTypeException(String.format("Mismatch of count of " +
                                                                    "formal and actual type " +
                                                                    "arguments in constructor " +
                                                                    "of %s: %d formal argument(s) "+
                                                                    "%d actual argument(s)",
                                                                    rawType.getName(),
                                                                    formals.length,
                                                                    actualTypeArguments.length));
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 3
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 4
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 5
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example 6
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 7
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example 8
Source Project: gadtry   Source File: JavaParameterizedTypeImpl.java    License: Apache License 2.0 5 votes vote down vote up
private void validateConstructorArguments()
{
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length) {
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 9
private void validateConstructorArguments() {
    TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }

}
 
Example 10
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 11
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example 12
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 13
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example 14
private void validateConstructorArguments() {
    TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }

}
 
Example 15
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 16
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example 17
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 18
Source Project: hottub   Source File: ParameterizedTypeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 19
Source Project: hottub   Source File: ParameterizedTypeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example 20
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 21
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example 22
Source Project: blueocean-plugin   Source File: TypeUtil.java    License: MIT License 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length) {
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }

}
 
Example 23
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 24
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example 25
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 26
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 27
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example 28
Source Project: AutoLoadCache   Source File: ParameterizedTypeImpl.java    License: Apache License 2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    @SuppressWarnings("rawtypes")
    TypeVariable[] arrayOfTypeVariable = this.rawType.getTypeParameters();

    if (arrayOfTypeVariable.length != this.actualTypeArguments.length) {
        throw new MalformedParameterizedTypeException();
    }
    // for(int i=0; i < this.actualTypeArguments.length; i++);
}
 
Example 29
/**
 * java.lang.reflect.MalformedParameterizedTypeException#MalformedParameterizedTypeException()
 */
public void test_Constructor() throws Exception {
    Constructor<MalformedParameterizedTypeException> ctor = MalformedParameterizedTypeException.class
            .getDeclaredConstructor();
    assertNotNull("Parameterless constructor does not exist.", ctor);
    assertTrue("Constructor is not protected", Modifier.isPublic(ctor
            .getModifiers()));
    assertNotNull(ctor.newInstance());
}
 
Example 30
/**
 * java.lang.reflect.MalformedParameterizedTypeException#
 * MalformedParameterizedTypeException()
 */
public void testMalformedParameterizedTypeException() {
    MalformedParameterizedTypeException e = new MalformedParameterizedTypeException();
    assertNotNull(e);
    assertNull(e.getMessage());
}