001 /**
002 * Copyright (C) 2009-2011 the original author or authors.
003 * See the notice.md file distributed with this work for additional
004 * information regarding copyright ownership.
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019 package org.codehaus.jackson.map.annotate;
020
021 import java.lang.annotation.ElementType;
022 import java.lang.annotation.Retention;
023 import java.lang.annotation.RetentionPolicy;
024 import java.lang.annotation.Target;
025
026 import org.codehaus.jackson.annotate.JacksonAnnotation;
027 import org.codehaus.jackson.map.jsontype.TypeIdResolver;
028
029 /**
030 * Annotation that can be used to plug a custom type identifier handler
031 * ({@link TypeIdResolver})
032 * to be used by
033 * {@link org.codehaus.jackson.map.TypeSerializer}s
034 * and {@link org.codehaus.jackson.map.TypeDeserializer}s
035 * for converting between java types and type id included in JSON content.
036 * In simplest cases this can be a simple class with static mapping between
037 * type names and matching classes.
038 *
039 * @author tatu
040 * @since 1.5
041 */
042 @Target({ElementType.TYPE})
043 @Retention(RetentionPolicy.RUNTIME)
044 @JacksonAnnotation
045 public @interface JsonTypeIdResolver
046 {
047 /**
048 * Defines implementation class of {@link TypeIdResolver} to use for
049 * converting between external type id (type name) and actual
050 * type of object.
051 */
052 public Class<? extends TypeIdResolver> value();
053 }