Code example for Field

Methods: hashCode, isAccessible

0
 
    public AllowedAccessor() { 
	try { 
	    this.field = DataClass.class.getDeclaredField("value");
	    System.err.println("field: " + field);
	    System.err.println("field.hash: " + field.hashCode());
	    System.err.println("field.accessible: " + field.isAccessible());
	} 
	catch(Exception ex) {
	    throw new RuntimeException(ex);
	} 
    } 
 
    public Field getField() {
	return field;
    } 
 
    public void printObject(DataClass data) {
	if(!field.isAccessible()) {
	    field.setAccessible(true);
	    System.err.println("field.accessible: " + field.isAccessible());