info.archinnov.achilles.annotations.Strategy Maven / Gradle / Ivy
/*
* 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.*;
import info.archinnov.achilles.type.strategy.InsertStrategy;
import info.archinnov.achilles.type.strategy.NamingStrategy;
/**
* Choose a strategy for insertion and schema naming.
* For insertion strategy, available values are :
*
* - {@code info.archinnov.achilles.type.InsertStrategy.ALL_FIELDS}
* - {@code info.archinnov.achilles.type.InsertStrategy.NOT_NULL_FIELDS}
*
*
* Default value = {@code info.archinnov.achilles.type.InsertStrategy.ALL_FIELDS}
*
* {@literal @}Table(table = "users")
* {@literal @}Strategy(insert = InsertStrategy.NOT_NULL_FIELDS)
* public class UserEntity;
*
*
* For naming strategy, available values are:
*
* - info.archinnov.achilles.type.NamingStrategy.SNAKE_CASE: transform all schema name using snake case
* - info.archinnov.achilles.type.NamingStrategy.CASE_SENSITIVE: enclose the name between double quotes (") for escaping the case
* - info.archinnov.achilles.type.NamingStrategy.LOWER_CASE: transform the name to lower case
* - info.archinnov.achilles.type.NamingStrategy.INHERIT_OR_LOWER_CASE: applies only to column name, either inherit the strategy from the class @Strategy annotation or default to lower case
*
*
* {@literal @}Table(table = "usersTable")
* {@literal @}Strategy(naming = NamingStrategy.SNAKE_CASE)
* public class UserEntity;
*
*
* @see Achilles Insert Strategies
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Documented
public @interface Strategy {
/**
* Strategy for insert
*
* Default = {@code info.archinnov.achilles.type.InsertStrategy.NOT_NULL_FIELDS}
*/
InsertStrategy insert() default InsertStrategy.ALL_FIELDS;
/**
* Strategy for keyspace, table and column names.Available values are :
*
* - info.archinnov.achilles.type.NamingStrategy.SNAKE_CASE
* - info.archinnov.achilles.type.NamingStrategy.CASE_SENSITIVE
* - info.archinnov.achilles.type.NamingStrategy.LOWER_CASE.
* - info.archinnov.achilles.type.NamingStrategy.INHERIT_OR_LOWER_CASE.
*
* If not set, defaults to {@code info.archinnov.achilles.type.NamingStrategy.LOWER_CASE}
*
* @return
*/
NamingStrategy naming() default NamingStrategy.LOWER_CASE;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy