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

Annotation for explicitly ignoring properties #14

Open
Clashsoft opened this issue Jan 13, 2020 · 2 comments
Open

Annotation for explicitly ignoring properties #14

Clashsoft opened this issue Jan 13, 2020 · 2 comments
Assignees
Labels
feature New feature or request

Comments

@Clashsoft
Copy link
Member

Clashsoft commented Jan 13, 2020

Add an annotation that flags properties for being ignored from yaml serialization. It would be placed on the getter.

Example:

class Person {
   String firstName;
   String lastName;

   String getFirstName() { ... }
   void setFirstName(String value) { ... }
   String getLastName() { ... }
   void setLastName(String value) { ... }

   @YamlIgnore // <--
   String getFullName() { return getFirstName() + getLastName() }
}
- p1: Person
  firstName: Bob
  lastName: Bobson

Instead of @YamlIgnore, there is already the java.beans.Transient annotation, which could have similar semantics.

@Clashsoft Clashsoft added the feature New feature or request label Jan 13, 2020
@Clashsoft Clashsoft self-assigned this Jan 13, 2020
@Clashsoft Clashsoft changed the title @YamlIgnore Annotation for explicitly ignoring properties Jan 13, 2020
@azuendorf
Copy link
Contributor

I like the solution, where we ignore properties that have no setter, more.

@Clashsoft
Copy link
Member Author

What about situations where there has to be a setter for legacy reasons (e.g. deprecated API)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants