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 for generic marshallers #153

Open
johnou opened this issue Apr 12, 2022 · 3 comments
Open

Support for generic marshallers #153

johnou opened this issue Apr 12, 2022 · 3 comments

Comments

@johnou
Copy link
Contributor

johnou commented Apr 12, 2022

I would like a way to use generic marshallers without relying on deprecated methods, right now org.infinispan.protostream.impl.SerializationContextImpl looks up marshallers using a hashmap with the class as a key which doesn't find a compatible marshaller. I am currently working around this by creating a MarshallerProvider.. would you consider keeping MarshallerProvider in order to maintain this functionality?

 serializationContext.registerMarshallerProvider(new MarshallerProvider() {
            @Override
            public BaseMarshaller<?> getMarshaller(String typeName) {
                return null;
            }

            @Override
            public BaseMarshaller<?> getMarshaller(Class<?> javaClass) {
                if (AbstractActor.class.isAssignableFrom(javaClass)) {
                    return getContext().getMarshaller(AbstractActor.class);
                }
                if (ActorObserver.class.isAssignableFrom(javaClass)) {
                    return getContext().getMarshaller(ActorObserver.class);
                }
                if (RemoteReference.class.isAssignableFrom(javaClass)) {
                    return getContext().getMarshaller(RemoteReference.class);
                }
                return null;
            }
        });
@tristantarrant
Copy link
Member

doesn't void registerMarshallerProvider(InstanceMarshallerProvider<?> marshallerProvider); work for you ?

@johnou
Copy link
Contributor Author

johnou commented May 19, 2022

doesn't void registerMarshallerProvider(InstanceMarshallerProvider<?> marshallerProvider); work for you ?

it does but it is marked deprecated.

@tristantarrant
Copy link
Member

@Deprecated
void registerMarshallerProvider(MarshallerProvider marshallerProvider);

is deprecated, but

void registerMarshallerProvider(InstanceMarshallerProvider<?> marshallerProvider);

is not.

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

No branches or pull requests

2 participants