Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting unmarshaller listener on binder #1631

Closed
plutext opened this issue May 14, 2022 · 1 comment · Fixed by #1633
Closed

Support setting unmarshaller listener on binder #1631

plutext opened this issue May 14, 2022 · 1 comment · Fixed by #1633

Comments

@plutext
Copy link

plutext commented May 14, 2022

abstract class Binder supports setEventHandler but not setListener

So currently, it is necessary to do something like:

	public void setListener(Binder binder, Listener listener) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
		
		org.glassfish.jaxb.runtime.v2.runtime.BinderImpl binderImpl = (org.glassfish.jaxb.runtime.v2.runtime.BinderImpl )binder;
		
		Method method = binderImpl.getClass().getDeclaredMethod("getUnmarshaller");
		method.setAccessible(true);
		Unmarshaller u  = (Unmarshaller)method.invoke(binderImpl);	
		u.setListener(listener);
	}

Please add setListener to Binder

@lukasj
Copy link
Member

lukasj commented May 16, 2022

filed jakartaee/jaxb-api#228 to get this supported through API; meanwhile it is going to be supported by this implementation; in the other words - one can avoid reflection..

lukasj added a commit that referenced this issue May 17, 2022
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants