001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.msgpack.annotation;
014
015import static java.lang.annotation.ElementType.*;
016import static java.lang.annotation.RetentionPolicy.*;
017
018import java.lang.annotation.*;
019
020import org.apache.juneau.annotation.*;
021import org.apache.juneau.msgpack.*;
022import org.apache.juneau.serializer.*;
023
024/**
025 * Annotation for specifying config properties defined in {@link MsgPackSerializer} and {@link MsgPackParser}.
026 *
027 * <p>
028 * Used primarily for specifying bean configuration properties on REST classes and methods.
029 *
030 * <h5 class='section'>See Also:</h5><ul>
031 *    <li class='link'><a class="doclink" href="../../../../../index.html#jm.MsgPackDetails">Overview &gt; juneau-marshall &gt; MessagePack Details</a>
032 * </ul>
033 */
034@Target({TYPE,METHOD})
035@Retention(RUNTIME)
036@Inherited
037@ContextApply({MsgPackConfigAnnotation.SerializerApply.class,MsgPackConfigAnnotation.ParserApply.class})
038public @interface MsgPackConfig {
039
040   /**
041    * Optional rank for this config.
042    *
043    * <p>
044    * Can be used to override default ordering and application of config annotations.
045    *
046    * @return The annotation value.
047    */
048   int rank() default 0;
049
050   //-------------------------------------------------------------------------------------------------------------------
051   // MsgPackCommon
052   //-------------------------------------------------------------------------------------------------------------------
053
054   //-------------------------------------------------------------------------------------------------------------------
055   // MsgPackSerializer
056   //-------------------------------------------------------------------------------------------------------------------
057
058   /**
059    * Add <js>"_type"</js> properties when needed.
060    *
061    * <p>
062    * If <js>"true"</js>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred
063    * through reflection.
064    *
065    * <p>
066    * When present, this value overrides the {@link org.apache.juneau.serializer.Serializer.Builder#addBeanTypes()} setting and is
067    * provided to customize the behavior of specific serializers in a {@link SerializerSet}.
068    *
069    * <ul class='values'>
070    *    <li><js>"true"</js>
071    *    <li><js>"false"</js> (default)
072    * </ul>
073    *
074    * <h5 class='section'>Notes:</h5><ul>
075    *    <li class='note'>
076    *       Supports <a class="doclink" href="../../../../../index.html#jm.DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
077    * </ul>
078    *
079    * <h5 class='section'>See Also:</h5><ul>
080    *    <li class='jm'>{@link org.apache.juneau.msgpack.MsgPackSerializer.Builder#addBeanTypesMsgPack()}
081    * </ul>
082    *
083    * @return The annotation value.
084    */
085   String addBeanTypes() default "";
086}