001/* 002 * Copyright 2015-2018 Transmogrify LLC. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.pyranid; 018 019import java.lang.annotation.ElementType; 020import java.lang.annotation.Retention; 021import java.lang.annotation.RetentionPolicy; 022import java.lang.annotation.Target; 023 024/** 025 * Allows specification of alternate column names for resultset mapping. 026 * <p> 027 * Useful in situations where column names are ugly, inconsistent, or do not map well to camel-case Java property names. 028 * <p> 029 * For example: 030 * 031 * <pre> 032 * class Example { 033 * @DatabaseColumn({ "systok", "sys_tok" }) 034 * UUID systemToken; 035 * 036 * UUID getSystemToken() { 037 * return systemToken; 038 * } 039 * 040 * void setSystemToken(UUID systemToken) { 041 * this.systemToken = systemToken; 042 * } 043 * } 044 * 045 * database.queryForObject("SELECT systok FROM example", Example.class); 046 * </pre> 047 * 048 * @author <a href="http://revetkn.com">Mark Allen</a> 049 * @since 1.0.0 050 */ 051@Target(ElementType.FIELD) 052@Retention(RetentionPolicy.RUNTIME) 053public @interface DatabaseColumn { 054 String[] value(); 055}