/** * Adds an annotation to the annotations that are considered by this serializer. * <p/> * <b>Important</b>: This will not have an effect if the serializer was configured * to exclusively serialize annotated fields by setting {@code disregarding} to * {@code false}. This is similar to the contract of this serializer's superclass * {@link FieldSerializer} which does not allow to add fields that were formerly * removed. If this was possible, instances that were serialized before this field * was added could not longer be properly deserialized. In order to make this contract * break explicit, you need to create a new instance of this serializer if you want to * include new fields to a serializer that exclusively serializes annotated fields. * * @param clazz The annotation class to be added. * @return {@code true} if the method call had an effect. */ public boolean addAnnotation(final Class<? extends Annotation> clazz) { if (disregarding && marked.add(clazz)) { initializeCachedFields(); return true; } return false; }
/** * Adds an annotation to the annotations that are considered by this serializer. * <p/> * <b>Important</b>: This will not have an effect if the serializer was configured * to exclusively serialize annotated fields by setting {@code disregarding} to * {@code false}. This is similar to the contract of this serializer's superclass * {@link FieldSerializer} which does not allow to add fields that were formerly * removed. If this was possible, instances that were serialized before this field * was added could not longer be properly deserialized. In order to make this contract * break explicit, you need to create a new instance of this serializer if you want to * include new fields to a serializer that exclusively serializes annotated fields. * * @param clazz The annotation class to be added. * @return {@code true} if the method call had an effect. */ public boolean addAnnotation(final Class<? extends Annotation> clazz) { if (disregarding && marked.add(clazz)) { initializeCachedFields(); return true; } return false; }
/** * Removes an annotation to the annotations that are considered by this serializer. * <p/> * <b>Important</b>: This will not have an effect if the serializer was configured * to not serialize annotated fields by setting {@code disregarding} to * {@code true}. This is similar to the contract of this serializer's superclass * {@link FieldSerializer} which does not allow to add fields that were formerly * removed. If this was possible, instances that were serialized before this field * was added could not longer be properly deserialized. In order to make this contract * break explicit, you need to create a new instance of this serializer if you want to * include new fields to a serializer that ignores annotated fields for serialization. * * @param clazz The annotation class to be removed. * @return {@code true} if the method call had an effect. */ public boolean removeAnnotation(final Class<? extends Annotation> clazz) { if (!disregarding && marked.remove(clazz)) { initializeCachedFields(); return true; } return false; } }
/** * Removes an annotation to the annotations that are considered by this serializer. * <p/> * <b>Important</b>: This will not have an effect if the serializer was configured * to not serialize annotated fields by setting {@code disregarding} to * {@code true}. This is similar to the contract of this serializer's superclass * {@link FieldSerializer} which does not allow to add fields that were formerly * removed. If this was possible, instances that were serialized before this field * was added could not longer be properly deserialized. In order to make this contract * break explicit, you need to create a new instance of this serializer if you want to * include new fields to a serializer that ignores annotated fields for serialization. * * @param clazz The annotation class to be removed. * @return {@code true} if the method call had an effect. */ public boolean removeAnnotation(final Class<? extends Annotation> clazz) { if (!disregarding && marked.remove(clazz)) { initializeCachedFields(); return true; } return false; } }