gsonpath.GsonPathDefaultConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gsonpath Show documentation
Show all versions of gsonpath Show documentation
An annotation processor which generates Type Adapters for the Google Gson library
package gsonpath;
import com.google.gson.FieldNamingPolicy;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specifies a set of default values for the {@link gsonpath.AutoGsonAdapter} class.
*
* This can aid removing repetition for developers who are not happy with the defaults
* provided out of the box.
*
* To use this class correctly, you must annotate a class, and then whenever you which to use
* these defaults you must set the {@link gsonpath.AutoGsonAdapter#defaultConfiguration} value to point to
* this annotated class.
*
* For example, creating defaults as follows:
*
* {@literal @}GsonPathDefaultConfiguration(flattenDelimiter = '$')
* class GsonPathDefaultConfiguration
* {
* }
*
* and then using it later:
*
* {@literal @}AutoGsonAdapter(defaults = GsonPathDefaultConfiguration.class)
* class ExampleModel
* {
* }
*
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface GsonPathDefaultConfiguration {
/**
* Refer to the documentation here: {@link AutoGsonAdapter#ignoreNonAnnotatedFields}
*
* @return whether non-annotated fields are ignored
*/
boolean ignoreNonAnnotatedFields() default false;
/**
* Refer to the documentation here: {@link AutoGsonAdapter#flattenDelimiter}
*
* @return the flatten delimiter to use.
*/
char flattenDelimiter() default '.';
/**
* Refer to the documentation here: {@link AutoGsonAdapter#fieldNamingPolicy}
*
* @return the field naming policy
*/
FieldNamingPolicy fieldNamingPolicy() default FieldNamingPolicy.IDENTITY;
/**
* Refer to the documentation here: {@link AutoGsonAdapter#serializeNulls}
*
* @return whether nulls are serialized
*/
boolean serializeNulls() default false;
/**
* Refer to the documentation here: {@link AutoGsonAdapter#fieldValidationType}
*
* @return the field validation type.
*/
GsonFieldValidationType fieldValidationType() default GsonFieldValidationType.NO_VALIDATION;
}