this library provides annotations for skipping properties during serialization/deserialization with SnakeYAML. Here are the key points about skipping properties with snakeyaml-anno:
You can use the @YamlProperty annotation with skipAtLoad = true to skip a property during deserialization (loading):
public class Person {
@YamlProperty(skipAtLoad = true)
public String name;
}
You can use skipAtDump = true to skip a property during serialization (dumping):
public class Person {
@YamlProperty(skipAtDump = true)
public String name;
}
There's also a skipAtDumpIf option to conditionally skip properties during dumping based on a predicate:
public class Person {
@YamlProperty(skipAtDumpIf = SkipIfNull.class)
public String name;
}
By default, empty/null properties are skipped during dumping globally. This can be changed when creating the AnnotationAwareRepresenter:
The library provides predefined SkipIfNull and SkipIfEmpty predicates for common skipping logic.
To use these annotations in your project, you would need to add the snakeyaml-anno dependency and use the AnnotationAwareConstructor and AnnotationAwareRepresenter when creating your Yaml instance. This would allow you to use the @YamlProperty annotations to control skipping of properties during serialization and deserialization.
this library provides annotations for skipping properties during serialization/deserialization with SnakeYAML. Here are the key points about skipping properties with snakeyaml-anno:
@YamlProperty
annotation withskipAtLoad = true
to skip a property during deserialization (loading):skipAtDump = true
to skip a property during serialization (dumping):skipAtDumpIf
option to conditionally skip properties during dumping based on a predicate:SkipIfNull
andSkipIfEmpty
predicates for common skipping logic.To use these annotations in your project, you would need to add the snakeyaml-anno dependency and use the
AnnotationAwareConstructor
andAnnotationAwareRepresenter
when creating your Yaml instance. This would allow you to use the@YamlProperty
annotations to control skipping of properties during serialization and deserialization.