All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.gsonfire.annotations.ExposeMethodResult Maven / Gradle / Ivy

Go to download

A java library that adds some very useful features to Gson, like Date serializing to unix timestamp or RFC3339, method (getter) serialization, pre and post processors and many more. Check out the documentation to learn how to use it!

There is a newer version: 1.9.0
Show newest version
package io.gsonfire.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @autor: julio
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ExposeMethodResult {

    enum ConflictResolutionStrategy{
        /**
         * Will overwrite the existing field on the {@link com.google.gson.JsonObject} that conflicts with the field
         * name being written
         */
        OVERWRITE,

        /**
         * Will skip writing to the {@link com.google.gson.JsonObject} if it contains a field with the name being used
         * by this method result
         */
        SKIP
    }

    /**
     * @return The name of the field to store the serialized result of the method
     */
    String value();

    /**
     * @return Strategy to be used when there is conflict between the name of a field on the Java Object vs the field name
     * where the result of the method will be serialized
     */
    ConflictResolutionStrategy conflictResolution() default ConflictResolutionStrategy.OVERWRITE;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy