private String getTypeName ( Type type ) { CheckArg . isNotNull ( type , "type" ) ; if ( type . isPrimitiveType ( ) ) { PrimitiveType primitiveType = ( PrimitiveType ) type ; return primitiveType . getPrimitiveTypeCode ( ) . toString ( ) ; } if ( type . isSimpleType ( ) ) { SimpleType simpleType = ( SimpleType ) type ; return JavaMetadataUtil . getName ( simpleType . getName ( ) ) ; } if ( type . isParameterizedType ( ) ) { ParameterizedType parameterizedType = ( ParameterizedType ) type ; return getTypeName ( parameterizedType . getType ( ) ) ; } if ( type . isArrayType ( ) ) { ArrayType arrayType = ( ArrayType ) type ; // the element type is never an array type Type elementType = arrayType . getElementType ( ) ; if ( elementType . isPrimitiveType ( ) ) { return ( ( PrimitiveType ) elementType ) . getPrimitiveTypeCode ( ) . toString ( ) ; } // can't be an array type if ( elementType . isSimpleType ( ) ) { return JavaMetadataUtil . getName ( ( ( SimpleType ) elementType ) . getName ( ) ) ; } } return null ; }
Extract the type name