Class ReflectionHelper
java.lang.Object
ghidra.app.util.bin.format.golang.structmapping.ReflectionHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassignField(Field field, Object obj, Object value) Write a value to a field in a java class.static <T> TcallCtor(Constructor<T> ctor, Object... params) static <T> ObjectcallGetter(Method getterMethod, T obj) static <T,R> R callGetter(Method getterMethod, T obj, Class<R> expectedType) static <T,CTX> T createInstance(Class<T> targetClass, CTX optionalContext) static MethodfindGetter(Class<?> structClass, String getterName) static <T extends Annotation>
List<T>getAnnotations(Class<?> targetClass, Class<T> annotationClass, List<T> result) static DataTypegetArrayOutputDataType(Object array_value, Class<?> fieldType, int length, Signedness signedness, DataTypeMapper dataTypeMapper) Return Ghidra data type representing an array of primitive values.static MethodgetCommentMethod(Class<?> clazz, String commentGetterName, String defaultGetterName) static <T> Constructor<T>static Signednessstatic <R> RgetFieldValue(Object obj, Field field, Class<R> expectedType) static voidgetMarkedMethods(Class<?> targetClass, Class<? extends Annotation> annotationClass, List<Method> methods, boolean includeParentClasses, Class<?>... paramClasses) static DataTypegetPrimitiveOutputDataType(Class<?> fieldType, int length, Signedness signedness, DataTypeMapper dataTypeMapper) static intgetPrimitiveSizeof(Class<?> fieldType) static booleanhasStructureMapping(Class<?> clazz) static voidinvokeMethods(List<Method> methods, Object obj, Object... params) static booleanisPrimitiveType(Class<?> clazz) static MethodrequireGetter(Class<?> clazz, String getterName)
-
Constructor Details
-
ReflectionHelper
public ReflectionHelper()
-
-
Method Details
-
isPrimitiveType
-
assignField
Write a value to a field in a java class.- Parameters:
field- reflectionFieldobj- java instance that contains the fieldvalue- value to write- Throws:
IOException
-
getArrayOutputDataType
public static DataType getArrayOutputDataType(Object array_value, Class<?> fieldType, int length, Signedness signedness, DataTypeMapper dataTypeMapper) Return Ghidra data type representing an array of primitive values.- Parameters:
array_value- java array objectfieldType-length-signedness-dataTypeMapper-- Returns:
-
getPrimitiveOutputDataType
public static DataType getPrimitiveOutputDataType(Class<?> fieldType, int length, Signedness signedness, DataTypeMapper dataTypeMapper) -
getPrimitiveSizeof
-
hasStructureMapping
-
getDataTypeSignedness
-
getCommentMethod
-
requireGetter
-
findGetter
-
getCtor
-
invokeMethods
public static void invokeMethods(List<Method> methods, Object obj, Object... params) throws IOException - Throws:
IOException
-
createInstance
public static <T,CTX> T createInstance(Class<T> targetClass, CTX optionalContext) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
callCtor
- Throws:
IllegalArgumentException
-
callGetter
- Throws:
IOException
-
callGetter
public static <T,R> R callGetter(Method getterMethod, T obj, Class<R> expectedType) throws IOException - Throws:
IOException
-
getMarkedMethods
-
getAnnotations
public static <T extends Annotation> List<T> getAnnotations(Class<?> targetClass, Class<T> annotationClass, List<T> result) -
getFieldValue
public static <R> R getFieldValue(Object obj, Field field, Class<R> expectedType) throws IOException - Throws:
IOException
-