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@Documented
031@Target({TYPE,METHOD})
032@Retention(RUNTIME)
033@Inherited
034@PropertyStoreApply(MsgPackConfigApply.class)
035public @interface MsgPackConfig {
036
037   /**
038    * Optional rank for this config.
039    *
040    * <p>
041    * Can be used to override default ordering and application of config annotations.
042    */
043   int rank() default 0;
044
045   //-------------------------------------------------------------------------------------------------------------------
046   // MsgPackSerializer
047   //-------------------------------------------------------------------------------------------------------------------
048
049   /**
050    * Configuration property:  Add <js>"_type"</js> properties when needed.
051    *
052    * <p>
053    * If <js>"true"</js>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred
054    * through reflection.
055    *
056    * <p>
057    * When present, this value overrides the {@link Serializer#SERIALIZER_addBeanTypes} setting and is
058    * provided to customize the behavior of specific serializers in a {@link SerializerGroup}.
059    *
060    * <ul class='notes'>
061    *    <li>
062    *       Possible values:
063    *       <ul>
064    *          <li><js>"true"</js>
065    *          <li><js>"false"</js> (default)
066    *       </ul>
067    *    <li>
068    *       Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>).
069    *    <li>
070    *       A default global value can be set via the system property <js>"MsgPackSerializer.addBeanTypes.b"</js>.
071    * </ul>
072    *
073    * <ul class='seealso'>
074    *    <li class='jf'>{@link MsgPackSerializer#MSGPACK_addBeanTypes}
075    * </ul>
076    */
077   String addBeanTypes() default "";
078}