Search in sources :

Example 1 with ArrayTypeBuilder

use of org.mule.metadata.api.builder.ArrayTypeBuilder in project mule by mulesoft.

the class IntrospectionUtilsTestCase method getDataTypeFromList.

@Test
public void getDataTypeFromList() {
    Class<List> listClass = List.class;
    Class<Integer> integerClass = Integer.class;
    ArrayTypeBuilder arrayTypeBuilder = BaseTypeBuilder.create(JAVA).arrayType().with(new ClassInformationAnnotation(listClass));
    arrayTypeBuilder.of().numberType().integer();
    CollectionDataType dataType = (CollectionDataType) toDataType(arrayTypeBuilder.build());
    assertThat(dataType.getType(), is(equalTo(listClass)));
    assertThat(dataType.getItemDataType().getType(), is(equalTo(integerClass)));
}
Also used : CollectionDataType(org.mule.runtime.api.metadata.CollectionDataType) List(java.util.List) ArrayList(java.util.ArrayList) ArrayTypeBuilder(org.mule.metadata.api.builder.ArrayTypeBuilder) ClassInformationAnnotation(org.mule.metadata.java.api.annotation.ClassInformationAnnotation) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Test (org.junit.Test)1 ArrayTypeBuilder (org.mule.metadata.api.builder.ArrayTypeBuilder)1 ClassInformationAnnotation (org.mule.metadata.java.api.annotation.ClassInformationAnnotation)1 CollectionDataType (org.mule.runtime.api.metadata.CollectionDataType)1 SmallTest (org.mule.tck.size.SmallTest)1