Browse Source

polish

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1556 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Keith Donald 17 years ago
parent
commit
8c6273f6dd
  1. 63
      org.springframework.context/src/main/java/org/springframework/ui/binding/support/ValueBuffer.java

63
org.springframework.context/src/main/java/org/springframework/ui/binding/support/ValueBuffer.java

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
/**
*
*/
package org.springframework.ui.binding.support;
import org.springframework.ui.binding.Binding.Model;
class ValueBuffer {
private Object value;
private boolean hasValue;
private Model model;
private boolean flushFailed;
private Exception flushException;
public ValueBuffer(Model model) {
this.model = model;
}
public boolean hasValue() {
return hasValue;
}
public Object getValue() {
if (!hasValue()) {
throw new IllegalStateException("No value in buffer");
}
return value;
}
public void setValue(Object value) {
this.value = value;
hasValue = true;
}
public void flush() {
try {
model.setValue(value);
clear();
} catch (Exception e) {
flushFailed = true;
flushException = e;
}
}
public void clear() {
value = null;
hasValue = false;
flushFailed = false;
}
public boolean flushFailed() {
return flushFailed;
}
public Exception getFlushException() {
return flushException;
}
}
Loading…
Cancel
Save