use of org.robobinding.presentationmodel.HasPresentationModelChangeSupport in project RoboBinding by RoboBinding.
the class PresentationModelObjectLoader method load.
public AbstractPresentationModelObject load(Object presentationModel) {
if (presentationModel instanceof HasPresentationModelChangeSupport) {
Preconditions.checkNotNull(((HasPresentationModelChangeSupport) presentationModel).getPresentationModelChangeSupport(), "The PresentationModelChangeSupport from presentationModel.getPresentationModelChangeSupport() must not be null");
}
String presentationModelObjectClassName = getObjectClassName(presentationModel.getClass().getName());
Class<?> presentationModelObjectType;
try {
presentationModelObjectType = Class.forName(presentationModelObjectClassName);
} catch (ClassNotFoundException e) {
throw new RuntimeException(MessageFormat.format("The source code for ''{0}'' is not generated. Is Java annotation processing(source code generation) correctly configured?", presentationModelObjectClassName));
}
try {
return (AbstractPresentationModelObject) ConstructorUtils.invokeConstructor(presentationModelObjectType, presentationModel);
} catch (NoSuchMethodException e) {
throw new Bug("This is a bug of constructor code generation", e);
} catch (IllegalAccessException e) {
throw new Bug("This is a bug of constructor code generation", e);
} catch (InvocationTargetException e) {
throw new Bug("This is a bug of constructor code generation", e);
} catch (InstantiationException e) {
throw new Bug("This is a bug of constructor code generation", e);
}
}
use of org.robobinding.presentationmodel.HasPresentationModelChangeSupport in project RoboBinding by RoboBinding.
the class PresentationModel_AutoGenerationTest method observePropertyChange.
private void observePropertyChange(Object presentationModel, String propertyName) {
PresentationModelChangeSupport changeSupport = ((HasPresentationModelChangeSupport) presentationModel).getPresentationModelChangeSupport();
changeSupport.addPropertyChangeListener(propertyName, propertyChangeListenerTester);
}
Aggregations