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

com.newpixelcoffee.odin.annotations.OdinMapAsList Maven / Gradle / Ivy

package com.newpixelcoffee.odin.annotations;

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

/**
 * If a field is a {@link java.util.Map} and the key of the map is inside values ( in a field ), you can write map as list of these values, so a map :
 * 
{@code map = {
 *     "key1" : {
 *         id = "key1"
 *         foo = 10
 *     }
 *     "key2" : {
 *         id = "key2"
 *         foo = 11
 *     }
 * }}
* Can be replaced by : *
{@code map = {
 *     {
 *         id = "key1"
 *         foo = 10
 *     }
 *     {
 *         id = "key2"
 *         foo = 11
 *     }
 * }}
* using this annotations : *
{@code @OdinMapAsList(keyField = "id")
 * Map map;}
* If the field value is an implementation of the field type and the implementation type also have an adapter registered in Odin, this adapter is forced and still used.
*/ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface OdinMapAsList { String keyField(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy