public static TypeName typeName(TypeMirror typeMirror) {
		LiteralType literalType = LiteralType.of(typeMirror.toString());

		if (literalType.isArray()) {
			return ArrayTypeName.of(typeName(literalType.getRawType()));
		} else if (literalType.isCollection()) {
			return ParameterizedTypeName.get(TypeUtility.className(literalType.getRawType()),
					typeName(literalType.getTypeParameter()));
		}

		TypeName[] values = { TypeName.BOOLEAN, TypeName.BYTE, TypeName.CHAR, TypeName.DOUBLE, TypeName.FLOAT,
				TypeName.INT, TypeName.LONG, TypeName.SHORT, TypeName.VOID };

		for (TypeName item : values) {
			if (typeMirror.toString().equals(item.toString())) {
				return item;
			}
		}

		return TypeName.get(typeMirror);
	}
public static TypeName typeName ( TypeMirror typeMirror ) { LiteralType literalType = LiteralType . of ( typeMirror . toString ( ) ) ; if ( literalType . isArray ( ) ) { return ArrayTypeName . of ( typeName ( literalType . getRawType ( ) ) ) ; } else if ( literalType . isCollection ( ) ) { return ParameterizedTypeName . get ( TypeUtility . className ( literalType . getRawType ( ) ) , typeName ( literalType . getTypeParameter ( ) ) ) ; } TypeName [ ] values = { TypeName . BOOLEAN , TypeName . BYTE , TypeName . CHAR , TypeName . DOUBLE , TypeName . FLOAT , TypeName . INT , TypeName . LONG , TypeName . SHORT , TypeName . VOID } ; for ( TypeName item : values ) { if ( typeMirror . toString ( ) . equals ( item . toString ( ) ) ) { return item ; } } return TypeName . get ( typeMirror ) ; }
Convert a TypeMirror in a typeName.

@param typeMirror
the type mirror
@return typeName