001/* 002 * Copyright 2011 Chris Pheby 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 */ 016package org.jadira.bindings.core.annotation; 017 018import java.lang.annotation.ElementType; 019import java.lang.annotation.Retention; 020import java.lang.annotation.RetentionPolicy; 021import java.lang.annotation.Target; 022 023/** 024 * This annotation, when applied to a method indicates that it is suitable for 025 * converting an object to or from a given representation as indicated by the 026 * method signature. 027 * <p> 028 * For any given ConverterScope, this annotation can be defined once for 029 * any related input / output class pair. 030 * <p> 031 * The annotation may be applied to either a static method, a constructor, or an 032 * instance method. In the case of the static method or the constructor, the 033 * annotated method must have a single parameter (the input class). In the case 034 * of a method, the return type must be of the output class. In the case of a 035 * constructor, this must be for the bound output class. The instance method 036 * takes no parameters, must be applied to the source (input) type and returns 037 * the output type. 038 * For disambiguation, @From and @To may be used instead 039 */ 040@Target({ ElementType.METHOD, ElementType.CONSTRUCTOR }) 041@Retention(RetentionPolicy.RUNTIME) 042public @interface Convert { 043}