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.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    /**
027     * Marker annotation that can be used to define a non-static
028     * method as a "setter" or "getter" for a logical property
029     * (depending on its signature),
030     * or non-static object field to be used (serialized, deserialized) as
031     * a logical property.
032     *<p>
033     * Default value ("") indicates that the field name is used
034     * as the property name without any modifications, but it
035     * can be specified to non-empty value to specify different
036     * name. Property name refers to name used externally, as
037     * the field name in Json objects.
038     *<p>
039     * NOTE: since version 1.1, annotation has also been applicable
040     * to fields (not with 1.0).
041     *<p>
042     * NOTE: since version 1.2, annotation has also been applicable
043     * to (constructor) parameters
044     */
045    @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
046    @Retention(RetentionPolicy.RUNTIME)
047    @JacksonAnnotation
048    public @interface JsonProperty
049    {
050        /**
051         * Defines name of the logical property, i.e. Json object field
052         * name to use for the property: if empty String (which is the
053         * default), will use name of the field that is annotated.
054         */
055        String value() default "";
056    }