org.jsimpledb.annotation.JSetField Maven / Gradle / Ivy
Show all versions of jsimpledb-main Show documentation
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package org.jsimpledb.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Java annotation for the getter methods of Java bean properties reflecting {@link org.jsimpledb.JSimpleDB}
* {@link java.util.Set} fields.
*
*
* The annotated method's return type must be either {@link java.util.Set Set}{@code },
* {@link java.util.SortedSet SortedSet}{@code }, or {@link java.util.NavigableSet NavigableSet}{@code },
* where {@code E} is a supported simple type.
*
*
* Note that both primitive types and their corresponding wrapper types are supported as elements. A set whose
* elements have primitive type will throw an exception on an attempt to add a null value.
* To specify a primitive element type, specify the type name (e.g., {@code "int"})
* as the {@link JField#type} in the {@link #element}.
*
*
Meta-Annotations
*
*
* This annotation may be configured indirectly as a Spring
* meta-annotation
* when {@code spring-core} is on the classpath.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
@Documented
public @interface JSetField {
/**
* The name of this field.
*
*
* If empty string (default value), the name is inferred from the name of the annotated Java bean getter method.
*
* @return the set field name
*/
String name() default "";
/**
* Storage ID for this field. Value should be positive and unique within the contained class.
* If zero, the configured {@link org.jsimpledb.StorageIdGenerator} will be consulted to auto-generate a value.
*
* @return the set field storage ID
* @see org.jsimpledb.StorageIdGenerator#generateFieldStorageId StorageIdGenerator.generateFieldStorageId()
*/
int storageId() default 0;
/**
* Storage ID and index setting for the field's elements. Note: the {@link JField#name name} property must be left unset.
*
* @return the set element field
*/
JField element() default @JField();
}