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

Allow Strings and URIs for the @Link annotation when serializing #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

andreas-eberle
Copy link

With this PR, it becomes possible to use the @Link annotation with Strings and URIs making the library less intrusive and easier to use.

Code Example:

        @Link
        public String stringLink = "http://something.com";

        @Link
        public URI uriLink = new URI("http://something.else.com");

@codecov
Copy link

codecov bot commented Apr 17, 2020

Codecov Report

Merging #27 into master will increase coverage by 0.25%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #27      +/-   ##
============================================
+ Coverage     77.27%   77.52%   +0.25%     
  Complexity       63       63              
============================================
  Files            10       10              
  Lines           352      356       +4     
  Branches         67       69       +2     
============================================
+ Hits            272      276       +4     
  Misses           72       72              
  Partials          8        8              
Impacted Files Coverage Δ Complexity Δ
.../jackson/dataformat/hal/ser/HALBeanSerializer.java 84.96% <100.00%> (+0.46%) 4.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f2834e1...9443455. Read the comment docs.

@andreas-eberle andreas-eberle changed the title Allow strings and URIs for the @Link annotation when serializing Allow Strings and URIs for the @Link annotation when serializing Apr 17, 2020
@andreas-eberle
Copy link
Author

@langecode: Could you have a look at this PR?

Copy link
Member

@langecode langecode left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution and it makes sense to be able to annotate an URI as HALLink. I think there is a semantic problem with the string version, though. The Java URI class does not support template URIs so it obviously must be non-templated. However, the string could both be templated or not templated and it is not possible to distinguish. I guess this could have been solved by adding an attribute to the annotation - however that could cause a conflict with the current us of HALLink which carries this information.

I will give it some thought if there is a good way to handle the annotated strings.

@@ -75,6 +84,9 @@ public void testSerialization() throws Exception {

@EmbeddedResource
public String nullString = null;

public TopResource() throws URISyntaxException {
Copy link
Member

Choose a reason for hiding this comment

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

Why add the default constructor?

@langecode
Copy link
Member

..and again thanks for the contribution. I had not noticed your PR before the mention, sorry.

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