MCPcopy Create free account
hub / github.com/java-native-access/jna / lookupField

Method lookupField

src/com/sun/jna/Native.java:873–887  ·  view source on GitHub ↗
(Class<?> mappingClass, String fieldName, Class<?> resultClass)

Source from the content-addressed store, hash-verified

871 }
872
873 private static Object lookupField(Class<?> mappingClass, String fieldName, Class<?> resultClass) {
874 try {
875 Field field = mappingClass.getField(fieldName);
876 field.setAccessible(true);
877 return field.get(null);
878 }
879 catch (NoSuchFieldException e) {
880 return null;
881 }
882 catch (Exception e) {
883 throw new IllegalArgumentException(fieldName + " must be a public field of type "
884 + resultClass.getName() + " ("
885 + e + "): " + mappingClass);
886 }
887 }
888
889 /** Return the preferred {@link TypeMapper} for the given native interface.
890 * See {@link com.sun.jna.Library#OPTION_TYPE_MAPPER}.

Callers 1

getLibraryOptionsMethod · 0.95

Calls 3

getNameMethod · 0.65
getFieldMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected