1 16 17 package org.springframework.validation; 18 19 import org.springframework.beans.ConfigurablePropertyAccessor; 20 import org.springframework.beans.DirectFieldAccessor; 21 import org.springframework.util.Assert; 22 23 37 public class DirectFieldBindingResult extends AbstractPropertyBindingResult { 38 39 private final Object target; 40 41 private transient DirectFieldAccessor directFieldAccessor; 42 43 44 49 public DirectFieldBindingResult(Object target, String objectName) { 50 super(objectName); 51 Assert.notNull(target, "Target bean must not be null"); 52 this.target = target; 53 } 54 55 56 public final Object getTarget() { 57 return target; 58 } 59 60 65 public final ConfigurablePropertyAccessor getPropertyAccessor() { 66 if (this.directFieldAccessor == null) { 67 this.directFieldAccessor = createDirectFieldAccessor(); 68 } 69 return this.directFieldAccessor; 70 } 71 72 76 protected DirectFieldAccessor createDirectFieldAccessor() { 77 return new DirectFieldAccessor(getTarget()); 78 } 79 80 } 81 | Popular Tags |