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

Do not do type conversion at encoding time by default anymore. #710

Merged
merged 1 commit into from
Aug 9, 2019

Conversation

sbernard31
Copy link
Contributor

Until now Leshan used by default a kind of magic converter.
This converter was used LwM2mNodeEncoder to fix LwM2mResource which would used a different
ResourceModel.Type than the one defined in the ResourceModel.

This magic conversion was mainly used to correct value which came from the leshan-server-demo UI...
So this does not make so much sense to keep this behavior by default.

So now the default converter is a NoValueConverter which do not do any converstion but raise an exception, if type in resource does not match the model.

If you want to keep the previous behavior you need to duplication class from leshan-server-demo : MagicLwM2mValueConverter and create your server like this :

LeshanServerBuilder builder = new LeshanServerBuilder();
builder.setEncoder(new DefaultLwM2mNodeEncoder(new MagicLwM2mValueConverter()));
LeshanServer server = builder.build();

Copy link
Contributor

@msangoi msangoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of keeping the MagicLwM2mValueConverter in the leshan-core package?

* one.
*
*/
public class NoValueConverter implements LwM2mValueConverter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This NoValue name is bit confusing. It is more a NoConversionConverter 😄.
CheckTypeConverter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed it by LwM2mValueChecker

@sbernard31
Copy link
Contributor Author

I prefer to not keep in in leshan-core as it is only needed for leshan-server-demo

@sbernard31 sbernard31 merged commit 680ee7d into master Aug 9, 2019
@sbernard31 sbernard31 deleted the no_converter branch August 12, 2019 08:26
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 this pull request may close these issues.

2 participants