Class FieldExtractor
- java.lang.Object
-
- science.aist.gtf.verification.syntactic.FieldExtractor
-
public class FieldExtractor extends Object
Class for extracting fields of class
- Since:
- 1.0
- Author:
- Christoph Praschl
-
-
Constructor Summary
Constructors Constructor Description FieldExtractor()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Field>
getAllFieldsForClass(Class<?> clazz)
static Field
getClassField(Class<?> clazz, String fieldName)
Method for getting a field by name and given classstatic <T> T
getDefaultValueForClass(Class<T> clazz)
Get default value of given clazzstatic <T> T
getDefaultValueForField(Field field)
Get default value of given clazz
-
-
-
Method Detail
-
getClassField
public static Field getClassField(Class<?> clazz, String fieldName)
Method for getting a field by name and given class- Parameters:
clazz
- Class which contains the fieldfieldName
- Name of the Field- Returns:
- the field
- Throws:
IllegalArgumentException
- if there is no field with given name
-
getDefaultValueForField
public static <T> T getDefaultValueForField(Field field)
Get default value of given clazz- Type Parameters:
T
- type of clazz- Parameters:
field
- field to be checked if there is a user defined default value- Returns:
- default value of field; if no user defined value was set returns default value of clazz
-
getDefaultValueForClass
public static <T> T getDefaultValueForClass(Class<T> clazz)
Get default value of given clazz- Type Parameters:
T
- type of clazz- Parameters:
clazz
- clazz for which default value should be get- Returns:
- default value of clazz
-
-