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

com.rt.storage.api.client.json.JsonString Maven / Gradle / Ivy

package com.rt.storage.api.client.json;

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

/**
 * Use this annotation to specify that a declared numeric Java field should map to a JSON string.
 *
 * 

By default declared Java numeric fields are stored as JSON numbers. For example: * *

 * 
 * class A {
 * @Key BigInteger value;
 * }
 * 
 * 
* *

can be used for this JSON content: * *

 * 
 * {"value" : 12345768901234576890123457689012345768901234576890}
 * 
 * 
* *

However, if instead the JSON content uses a JSON String to store the value, one needs to use * the {@link JsonString} annotation. For example: * *

 * 
 * class B {
 * @Key @JsonString BigInteger value;
 * }
 * 
 * 
* *

can be used for this JSON content: * *

 * 
 * {"value" : "12345768901234576890123457689012345768901234576890"}
 * 
 * 
* * @since 1.3 * @author Yaniv Inbar */ // TODO(yanivi): remove JsonString and instead declare new primitives BigIntegerString and // BigDecimalString? @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface JsonString {}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy