sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl Java Examples

The following examples show how to use sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl. 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
Source File: JavaTypesTest.java    From gadtry with Apache License 2.0 6 votes vote down vote up
@Test
public void typeToClassGiveGenericArrayType()
{
    Type type = JavaTypes.make(List.class, new Type[] {String.class}, null);
    Type arrayType = GenericArrayTypeImpl.make(type);

    Assert.assertTrue(JavaTypes.isClassType(arrayType));
    Assert.assertEquals(JavaTypes.typeToClass(arrayType), List[].class);

    try {
        JavaTypes.typeToClass(AopFactory.proxy(Type.class).byInstance(String.class).before(a -> {}));
        Assert.fail();
    }
    catch (IllegalArgumentException e) {
        Assert.assertEquals("Cannot convert type to class", e.getMessage());
    }
}
 
Example #2
Source File: ArrayType.java    From gadtry with Apache License 2.0 4 votes vote down vote up
public ArrayType(Type valueType)
{
    this.genericArrayType = GenericArrayTypeImpl.make(valueType);
}