static NativeType getDefaultConversion ( Type t ) { if ( t instanceof Class ) { Class < ? > c = ( Class < ? > ) t ; NativeType r = defaultConversions . get ( c ) ; if ( r != null ) return r ; if ( Com4jObject . class . isAssignableFrom ( c ) ) return NativeType . ComObject ; if ( Enum . class . isAssignableFrom ( c ) ) return NativeType . Int32 ; if ( Buffer . class . isAssignableFrom ( c ) ) return NativeType . PVOID ; if ( Calendar . class . isAssignableFrom ( c ) ) return NativeType . Date ; if ( BigDecimal . class . isAssignableFrom ( c ) ) return NativeType . Currency ; if ( c . isArray ( ) ) return NativeType . SafeArray ; } if ( t instanceof ParameterizedType ) { ParameterizedType p = ( ParameterizedType ) t ; if ( p . getRawType ( ) == Holder . class ) { // let p=Holder<V> Type v = p . getActualTypeArguments ( ) [ 0 ] ; Class < ? > c = ( v instanceof Class ) ? ( Class < ? > ) v : null ; if ( c != null ) { if ( Com4jObject . class . isAssignableFrom ( c ) ) return NativeType . ComObject_ByRef ; if ( String . class == c ) return NativeType . BSTR_ByRef ; if ( Integer . class == c || Enum . class . isAssignableFrom ( c ) ) return NativeType . Int32_ByRef ; if ( Boolean . class == c ) return NativeType . VariantBool_ByRef ; if ( Buffer . class . isAssignableFrom ( c ) ) return NativeType . PVOID_ByRef ; if ( Double . class . isAssignableFrom ( c ) ) return NativeType . Double_ByRef ; if ( c . isArray ( ) ) return NativeType . SafeArray_ByRef ; } if ( v instanceof GenericArrayType ) { return NativeType . SafeArray_ByRef ; } } if ( p . getRawType ( ) == Iterator . class ) { return NativeType . ComObject ; } } throw new IllegalAnnotationException ( "no default conversion available for " + t ) ; }
Computes the default conversion for the given type .