Person person = (Person )ObjectModelUtilities.createLocalObjectModel(Person.class);
System.out.println(person);
System.out.println(person.equals(person));
System.out.println(person.equals(new Object()));
ObjectModelUtilities.addPropertyListener(person, "name", new ObjectModelPropertyValueListener() {
@Override
public void valueChanging(ObjectModelPropertyValueEvent event) {
System.out.println("changing " + event.getProperty() + " from " + event.getOldValue() + " to " + event.getNewValue());
event.setNewValue("HAHA!");
}
@Override
public void valueChanged(ObjectModelPropertyValueEvent event) {
System.out.println("changed " + event.getProperty() + " from " + event.getOldValue() + " to " + event.getNewValue());
}
});
ObjectModelUtilities.setPropertyValue(person, "name", "Jason");
System.out.println(ObjectModelUtilities.getPropertyValue(person, "name"));
Pet pet = new Pet();
ObjectModelUtilities.addPropertyListener(pet, "age", new ObjectModelPropertyValueListener() {
@Override
public void valueChanging(ObjectModelPropertyValueEvent event) {
System.out.println("changing " + event.getProperty() + " from " + event.getOldValue() + " to " + event.getNewValue());
event.setNewValue(new Integer(6));
}