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.uon.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.serializer.*; 022import org.apache.juneau.uon.*; 023import org.apache.juneau.urlencoding.*; 024 025/** 026 * Annotation for specifying config properties defined in {@link UonSerializer} and {@link UonParser}. 027 * 028 * <p> 029 * Used primarily for specifying bean configuration properties on REST classes and methods. 030 */ 031@Documented 032@Target({TYPE,METHOD}) 033@Retention(RUNTIME) 034@Inherited 035@PropertyStoreApply(UonConfigApply.class) 036public @interface UonConfig { 037 038 //------------------------------------------------------------------------------------------------------------------- 039 // UonParser 040 //------------------------------------------------------------------------------------------------------------------- 041 042 /** 043 * Configuration property: Decode <js>"%xx"</js> sequences. 044 * 045 * <p> 046 * Specify <js>"true"</js> if URI encoded characters should be decoded, <js>"false"</js> if they've already been decoded 047 * before being passed to this parser. 048 * 049 * <ul class='notes'> 050 * <li> 051 * Possible values: 052 * <ul> 053 * <li><js>"true"</js> 054 * <li><js>"false"</js> 055 * </ul> 056 * <li> 057 * The default is <js>"false"</js> for {@link UonParser}, <js>"true"</js> for {@link UrlEncodingParser}. 058 * <li> 059 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 060 * <li> 061 * A default global value can be set via the system property <js>"UonParser.decoding.b"</js>. 062 * </ul> 063 * 064 * <ul class='seealso'> 065 * <li class='jf'>{@link UonParser#UON_decoding} 066 * </ul> 067 */ 068 String decoding() default ""; 069 070 /** 071 * Configuration property: Validate end. 072 * 073 * <p> 074 * If <js>"true"</js>, after parsing a POJO from the input, verifies that the remaining input in 075 * the stream consists of only comments or whitespace. 076 * 077 * <ul class='notes'> 078 * <li> 079 * Possible values: 080 * <ul> 081 * <li><js>"true"</js> 082 * <li><js>"false"</js> (default) 083 * </ul> 084 * <li> 085 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 086 * <li> 087 * A default global value can be set via the system property <js>"UonParser.validateEnd.b"</js>. 088 * </ul> 089 090 * <ul class='seealso'> 091 * <li class='jf'>{@link UonParser#UON_validateEnd} 092 * </ul> 093 */ 094 String validateEnd() default ""; 095 096 //------------------------------------------------------------------------------------------------------------------- 097 // UonSerializer 098 //------------------------------------------------------------------------------------------------------------------- 099 100 /** 101 * Configuration property: Add <js>"_type"</js> properties when needed. 102 * 103 * <p> 104 * If <js>"true"</js>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred 105 * through reflection. 106 * 107 * <p> 108 * When present, this value overrides the {@link Serializer#SERIALIZER_addBeanTypes} setting and is 109 * provided to customize the behavior of specific serializers in a {@link SerializerGroup}. 110 * 111 * <ul class='notes'> 112 * <li> 113 * Possible values: 114 * <ul> 115 * <li><js>"true"</js> 116 * <li><js>"false"</js> (default) 117 * </ul> 118 * <li> 119 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 120 * <li> 121 * A default global value can be set via the system property <js>"UonSerializer.addBeanTypes.b"</js>. 122 * </ul> 123 * 124 * <ul class='seealso'> 125 * <li class='jf'>{@link UonSerializer#UON_addBeanTypes} 126 * </ul> 127 */ 128 String addBeanTypes() default ""; 129 130 /** 131 * Configuration property: Encode non-valid URI characters. 132 * 133 * <p> 134 * Encode non-valid URI characters with <js>"%xx"</js> constructs. 135 * 136 * <p> 137 * If <js>"true"</js>, non-valid URI characters will be converted to <js>"%xx"</js> sequences. 138 * <br>Set to <js>"false"</js> if parameter value is being passed to some other code that will already perform 139 * URL-encoding of non-valid URI characters. 140 * 141 * <p> 142 * Possible values: 143 * <ul> 144 * <li><js>"true"</js> 145 * <li><js>"false"</js> 146 * </ul> 147 * 148 * <ul class='notes'> 149 * <li> 150 * Possible values: 151 * <ul> 152 * <li><js>"true"</js> 153 * <li><js>"false"</js> 154 * </ul> 155 * <li> 156 * The default is <js>"false"</js> for {@link UonSerializer}, <js>"true"</js> for {@link UrlEncodingSerializer}. 157 * <li> 158 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 159 * <li> 160 * A default global value can be set via the system property <js>"UonSerializer.encoding.b"</js>. 161 * </ul> 162 * 163 * <ul class='seealso'> 164 * <li class='jf'>{@link UonSerializer#UON_encoding} 165 * </ul> 166 */ 167 String encoding() default ""; 168 169 /** 170 * Configuration property: Format to use for query/form-data/header values. 171 * 172 * <p> 173 * Specifies the format to use for URL GET parameter keys and values. 174 * 175 * <ul class='notes'> 176 * <li> 177 * Possible values: 178 * <ul> 179 * <li><js>"UON"</js> (default) - Use UON notation for parameters. 180 * <li><js>"PLAINTEXT"</js> - Use plain text for parameters. 181 * </ul> 182 * <li> 183 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 184 * <li> 185 * A default global value can be set via the system property <js>"UonSerializer.paramFormat.s"</js>. 186 * </ul> 187 * 188 * <ul class='seealso'> 189 * <li class='jf'>{@link UonSerializer#UON_paramFormat} 190 * </ul> 191 */ 192 String paramFormat() default ""; 193}