1 19 package org.apache.cayenne.reflect.pojo; 20 21 import org.apache.cayenne.reflect.Accessor; 22 import org.apache.cayenne.reflect.FieldAccessor; 23 24 30 class EnhancedPojoPropertyFaultHandler { 31 32 static final String FAULT_FIELD_PREFIX = "$cay_faultResolved_"; 33 34 private Accessor faultResolvedFlagAccessor; 35 36 EnhancedPojoPropertyFaultHandler(Class objectClass, String propertyName) { 37 this.faultResolvedFlagAccessor = new FieldAccessor( 38 objectClass, 39 FAULT_FIELD_PREFIX + propertyName, 40 Boolean.TYPE); 41 } 42 43 boolean isFaultProperty(Object object) { 44 return !((Boolean ) faultResolvedFlagAccessor.getValue(object)).booleanValue(); 45 } 46 47 void setFaultProperty(Object object, boolean flag) { 48 faultResolvedFlagAccessor.setValue(object, flag ? Boolean.FALSE : Boolean.TRUE); 51 } 52 } 53 | Popular Tags |