@Test public void to_description_array() { start(new Callback() { @Override protected void test() { TypeMirror type = types.getArrayType(getType(String.class)); TypeDescription desc = DescriptionHelper.toDescription(env, type); assertThat(desc, is((Object) Descriptions.typeOf(String[].class))); } }); }
public static TypeDescription toDescription(CompileEnvironment environment, TypeMirror type) { switch (type.getKind()) { case DECLARED: return toDescription(environment, (javax.lang.model.type.DeclaredType) type); case ARRAY: return toDescription(environment, (javax.lang.model.type.ArrayType) type); case BOOLEAN: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.BOOLEAN); case BYTE: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.BYTE); case SHORT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.SHORT); case INT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.INT); case LONG: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.LONG); case FLOAT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.FLOAT); case DOUBLE: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.DOUBLE); case CHAR: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.CHAR); case VOID: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.VOID); default: throw new AssertionError(MessageFormat.format( "unsupported type: {0}", type)); } }
DescriptionHelper { public static TypeDescription toDescription(CompileEnvironment environment, TypeMirror type) { switch (type.getKind()) { case DECLARED: return toDescription(environment, (javax.lang.model.type.DeclaredType) type); case ARRAY: return toDescription(environment, (javax.lang.model.type.ArrayType) type); case BOOLEAN: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.BOOLEAN); case BYTE: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.BYTE); case SHORT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.SHORT); case INT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.INT); case LONG: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.LONG); case FLOAT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.FLOAT); case DOUBLE: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.DOUBLE); case CHAR: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.CHAR); case VOID: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.VOID); default: throw new AssertionError(MessageFormat.format( "unsupported type: {0}", type)); } } }
DescriptionHelper { public static TypeDescription toDescription(CompileEnvironment environment, TypeMirror type) { switch (type.getKind()) { case DECLARED: return toDescription(environment, (javax.lang.model.type.DeclaredType) type); case ARRAY: return toDescription(environment, (javax.lang.model.type.ArrayType) type); case BOOLEAN: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.BOOLEAN); case BYTE: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.BYTE); case SHORT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.SHORT); case INT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.INT); case LONG: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.LONG); case FLOAT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.FLOAT); case DOUBLE: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.DOUBLE); case CHAR: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.CHAR); case VOID: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.VOID); default: throw new AssertionError(MessageFormat.format( "unsupported type: {0}", type)); } } private  DescriptionHelper(); }
DescriptionHelper { public static TypeDescription toDescription(CompileEnvironment environment, TypeMirror type) { switch (type.getKind()) { case DECLARED: return toDescription(environment, (javax.lang.model.type.DeclaredType) type); case ARRAY: return toDescription(environment, (javax.lang.model.type.ArrayType) type); case BOOLEAN: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.BOOLEAN); case BYTE: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.BYTE); case SHORT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.SHORT); case INT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.INT); case LONG: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.LONG); case FLOAT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.FLOAT); case DOUBLE: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.DOUBLE); case CHAR: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.CHAR); case VOID: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.VOID); default: throw new AssertionError(MessageFormat.format( "unsupported type: {0}", type)); } } private  DescriptionHelper(); static TypeDescription toDescription(CompileEnvironment environment, TypeMirror type); static ClassDescription toDescription(CompileEnvironment environment, TypeElement element); static ClassDescription toDescription(
            CompileEnvironment environment,
            javax.lang.model.type.DeclaredType type); static Type resolve(ImportBuilder importer, TypeDescription type); static Expression resolveValue(ImportBuilder importer, ValueDescription value); static Expression resolveConstant(ImportBuilder importer, ValueDescription constant); static Annotation resolveAnnotation(ImportBuilder importer, AnnotationDescription annotation); }
DescriptionHelper { public static TypeDescription toDescription(CompileEnvironment environment, TypeMirror type) { switch (type.getKind()) { case DECLARED: return toDescription(environment, (javax.lang.model.type.DeclaredType) type); case ARRAY: return toDescription(environment, (javax.lang.model.type.ArrayType) type); case BOOLEAN: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.BOOLEAN); case BYTE: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.BYTE); case SHORT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.SHORT); case INT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.INT); case LONG: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.LONG); case FLOAT: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.FLOAT); case DOUBLE: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.DOUBLE); case CHAR: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.CHAR); case VOID: return new BasicTypeDescription(BasicTypeDescription.BasicTypeKind.VOID); default: throw new AssertionError(MessageFormat.format( "unsupported type: {0}", type)); } } private  DescriptionHelper(); static TypeDescription toDescription(CompileEnvironment environment, TypeMirror type); static ClassDescription toDescription(CompileEnvironment environment, TypeElement element); static ClassDescription toDescription(
            CompileEnvironment environment,
            javax.lang.model.type.DeclaredType type); static Type resolve(ImportBuilder importer, TypeDescription type); static Expression resolveValue(ImportBuilder importer, ValueDescription value); static Expression resolveConstant(ImportBuilder importer, ValueDescription constant); static Annotation resolveAnnotation(ImportBuilder importer, AnnotationDescription annotation);  }