Class GsonDocumentExclusionStrategy
java.lang.Object
eu.cloudnetservice.driver.impl.document.gson.GsonDocumentExclusionStrategy
- All Implemented Interfaces:
com.google.gson.ExclusionStrategy
final class GsonDocumentExclusionStrategy
extends Object
implements com.google.gson.ExclusionStrategy
An exclusion strategy implementation that takes the
DocumentValueIgnore annotation into account.- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GsonDocumentExclusionStrategyThe jvm static exclusion strategy for the deserialize direction.private final eu.cloudnetservice.driver.document.annotations.DocumentValueIgnore.Directionstatic final GsonDocumentExclusionStrategyThe jvm static exclusion strategy for the serialize direction. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateGsonDocumentExclusionStrategy(eu.cloudnetservice.driver.document.annotations.DocumentValueIgnore.Direction direction) Constructs a new exclusion strategy that ignores members that are annotated withDocumentValueIgnoreand exclude the given direction. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanshouldExclude(@Nullable eu.cloudnetservice.driver.document.annotations.DocumentValueIgnore ignoreAnnotation) Check if the given annotation instance is present and disables the serialisation into the direction handled by this exclusion strategy.booleanshouldSkipClass(@NonNull Class<?> clazz) booleanshouldSkipField(@NonNull com.google.gson.FieldAttributes field)
-
Field Details
-
SERIALIZE
The jvm static exclusion strategy for the serialize direction. -
DESERIALIZE
The jvm static exclusion strategy for the deserialize direction. -
direction
private final eu.cloudnetservice.driver.document.annotations.DocumentValueIgnore.Direction direction
-
-
Constructor Details
-
GsonDocumentExclusionStrategy
private GsonDocumentExclusionStrategy(@NonNull eu.cloudnetservice.driver.document.annotations.DocumentValueIgnore.Direction direction) Constructs a new exclusion strategy that ignores members that are annotated withDocumentValueIgnoreand exclude the given direction.- Parameters:
direction- the serialize direction of members to exclude.- Throws:
NullPointerException- if the given direction is null.
-
-
Method Details
-
shouldSkipField
-
shouldSkipClass
-
shouldExclude
private boolean shouldExclude(@Nullable @Nullable eu.cloudnetservice.driver.document.annotations.DocumentValueIgnore ignoreAnnotation) Check if the given annotation instance is present and disables the serialisation into the direction handled by this exclusion strategy.- Parameters:
ignoreAnnotation- the optional ignore annotation instance to validate.- Returns:
- true if the member should be excluded from the target direction, false otherwise.
-