Package com.sun.jna
Klasse DefaultTypeMapper
java.lang.Object
com.sun.jna.DefaultTypeMapper
- Alle implementierten Schnittstellen:
TypeMapper
- Bekannte direkte Unterklassen:
W32APITypeMapper
Provide custom mappings to and from native types. The default lookup
checks classes corresponding to converters in the order added; if the
class to be converted is an instance of the converter's registered class,
the converter will be used.
Derived classes should install additional converters using
addToNativeConverter(java.lang.Class<?>, com.sun.jna.ToNativeConverter)
and/or addFromNativeConverter(java.lang.Class<?>, com.sun.jna.FromNativeConverter)
in the default constructor. Classes
for primitive types will automatically register for the corresponding
Object type and vice versa (i.e. you don't have to register both
int.class
and Integer.class
).
If you want different mapping behavior than the default, simply override
getToNativeConverter(java.lang.Class<?>)
and getFromNativeConverter(java.lang.Class<?>)
.
- Siehe auch:
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
addFromNativeConverter
(Class<?> cls, FromNativeConverter converter) Add aFromNativeConverter
to convert a native result type into the given Java type.void
addToNativeConverter
(Class<?> cls, ToNativeConverter converter) Add aToNativeConverter
to define the conversion into a native type from arguments of the given Java type.void
addTypeConverter
(Class<?> cls, TypeConverter converter) Add aTypeConverter
to provide bidirectional mapping between a native and Java type.getFromNativeConverter
(Class<?> javaType) Return theFromNativeConverter
appropriate for the given Java class.getToNativeConverter
(Class<?> javaType) Return theToNativeConverter
appropriate for the given Java class.
-
Konstruktordetails
-
DefaultTypeMapper
public DefaultTypeMapper()
-
-
Methodendetails
-
addToNativeConverter
Add aToNativeConverter
to define the conversion into a native type from arguments of the given Java type. Converters are checked for in the order added.- Parameter:
cls
- Java class requiring conversionconverter
-ToNativeConverter
to transform an object of the given Java class into its native-compatible form.
-
addFromNativeConverter
Add aFromNativeConverter
to convert a native result type into the given Java type. Converters are checked for in the order added.- Parameter:
cls
- Java class for the Java representation of a native type.converter
-FromNativeConverter
to transform a native-compatible type into its Java equivalent.
-
addTypeConverter
Add aTypeConverter
to provide bidirectional mapping between a native and Java type.- Parameter:
cls
- Java class representation for a native typeconverter
-TypeConverter
to translate between native and Java types.
-
getFromNativeConverter
Beschreibung aus Schnittstelle kopiert:TypeMapper
Return theFromNativeConverter
appropriate for the given Java class.- Angegeben von:
getFromNativeConverter
in SchnittstelleTypeMapper
- Parameter:
javaType
- Java class representation of the native type.- Gibt zurück:
- Converter from the native-compatible type.
-
getToNativeConverter
Beschreibung aus Schnittstelle kopiert:TypeMapper
Return theToNativeConverter
appropriate for the given Java class.- Angegeben von:
getToNativeConverter
in SchnittstelleTypeMapper
- Parameter:
javaType
- Java class representation of the native type.- Gibt zurück:
- Converter to the native-compatible type.
-