import java.lang.reflect.Field;
-
/**
- * Utility for interfacing to a field of an object.
+ * Utility for interfacing to a field of an object.
*
* @author Erik Brakkee
- *
- * @param <T> Type of the field.
+ *
+ * @param <T>
+ * Type of the field.
*/
public class FieldAccessor<T> implements Accessor<T> {
private Field field;
/**
- * Constructs the accessor.
- * @param aField Field.
+ * Constructs the accessor.
+ *
+ * @param aField
+ * Field.
*/
public FieldAccessor(Field aField) {
field = aField;
}
/**
- * Gets the field.
- * @return Field.
+ * Gets the field.
+ *
+ * @return Field.
*/
public Field getField() {
return field;
}
+
+ @Override
+ public Class<T> getType() {
+ return (Class<T>) field.getType();
+ }
+
+ @Override
+ public String toString() {
+ return "fieldInjection(" + field + ")";
+ }
}
\ No newline at end of file