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

info.archinnov.achilles.annotations.Enumerated Maven / Gradle / Ivy

There is a newer version: 6.1.0
Show newest version
/*
 * Copyright (C) 2012-2016 DuyHai DOAN
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package info.archinnov.achilles.annotations;

import java.lang.annotation.*;

/**

 * Annotation for enum type column. Example
 * 


 * {@literal @}Column
 * {@literal @}Enumerated(Encoding.ORDINAL)
 * private Pricing pricing;
 * 
* It can be also applied to nested enums too: *


 * {@literal @}Column
 * private List<{@literal @}Enumerated(Encoding.ORDINAL) Pricing> pricingTypes;
 * 
*

* * @see @Column */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @Documented public @interface Enumerated { /** * (Optional) The encoding type for this value. Default value is Encoding.NAME e.g. enum value will be converted * to string by calling the .name() method. *
*
* Alternatively it is possible to encode using Encoding.ORDINAL. In this case enum value will be saved using the ordinal value * (order in which each enum is declared in the source class). Please note that the ordinal is 0-based *


     * {@literal @}Enumerated(Encoding.ORDINAL)
     * private Pricing pricingType;
     * 
*/ Encoding value() default Encoding.NAME; enum Encoding { NAME, ORDINAL } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy