You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
So far I did not found any explicit statement in the Java Bean Specification,
that PropertyChangeEvents have not to be fired before an attribute was changed.
But in all implementations of the Java framework and all examples using
PropertyChangedEvents the events are fired only after a change and not before.
Maybe the property-listener-injector should be follow this behavior too?
Arranging this is pretty simple. Just modify the code generating the body of the
setMethod in:
Having got hold of the sources from the above location, I can attempt to fix this myself, but I would rather pull in a publically-available plugin/dependency...
So far I did not found any explicit statement in the Java Bean Specification,
that PropertyChangeEvents have not to be fired before an attribute was changed.
But in all implementations of the Java framework and all examples using
PropertyChangedEvents the events are fired only after a change and not before.
Maybe the property-listener-injector should be follow this behavior too?
Arranging this is pretty simple. Just modify the code generating the body of the
setMethod in:
com.sun.tools.xjc.addon.property_listener_injector.SingleField:201
JBlock body = $set.body();
if (boundType!=null) {
if (boundType==Kind.VETOABLE)
{ JTryBlock tryBlock = body._try(); JClass vetoableClass = (JClass) codeModel._ref(java.beans.PropertyVetoException.class); tryBlock.body().add( JExpr.ref("support").invoke("fireVetoableChange"). arg(prop.getName(false)).arg(JExpr.refthis(ref().name())).arg($value)); //tryBlock.body().directStatement("support.fireVetoableChange("" + prop.getName(false)+ ""," + ref().name() + ", value);"); JCatchBlock catchBlock = tryBlock._catch(vetoableClass); catchBlock.body().directStatement("return;"); body.assign(JExpr._this().ref(ref()),castToImplType($value)); }
else
{ JVar $oldValue = body.decl(setterType, "oldValue", JExpr.ref("value")); body.assign(JExpr._this().ref(ref()),castToImplType($value)); body.add(JExpr.ref("support").invoke("firePropertyChange"). arg(prop.getName(false)).arg($oldValue).arg($value)); }
} else
{ body.assign(JExpr._this().ref(ref()),castToImplType($value)); }
The pom.xml needs an update too. I compiled it versus com.sun.xml.bind/jaxb-xjc/2.2
Environment
Operating System: All
Platform: All
Affected Versions
[current]
The text was updated successfully, but these errors were encountered: