public interface IOther {
void setString(String string) ;
}
import java.beans.PropertyEditorSupport; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Field; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationEvent; public class Other implements IOther { private String string; public Other() { // TODO Auto-generated constructor stub } public Other(String string) { this.string = string; System.out.println(string); } public String getString() { return string; } public void setString(String string) { this.string = string; System.out.println(string); } }
import java.beans.PropertyEditorSupport; import java.util.Calendar; public class DateEditor extends PropertyEditorSupport { @Override public void setAsText(String text) throws IllegalArgumentException { if (text.matches("[0-9]{4}-[0-9]{2}-[0-9]{2}")) { String[] strings=text.split("-"); int year=Integer.parseInt(strings[0]); int month=Integer.parseInt(strings[1])-1; int day=Integer.parseInt(strings[2]); Calendar calendar=Calendar.getInstance(); calendar.set(year,month,day); setValue(calendar.getTime()); } } }