001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.camel.dataformat.bindy.annotation;
018
019 import java.lang.annotation.Documented;
020 import java.lang.annotation.Retention;
021 import java.lang.annotation.RetentionPolicy;
022
023 /**
024 * An annotation used to identify in a POJO which property is link to a key value pair field
025 * The tag (mandatory) identifies the key of the key value pair (e.g. 8 equals the begin string in FIX
026 * The name (optional) could be used in the future to bind a property which a different name
027 * The pattern (optional) allows to define the pattern of the data (useful for Date, BigDecimal ...)
028 * The precision (optional) reflects the precision to be used with BigDecimal number
029 * The required (optional) field allows to define if the field is required or not. This property is
030 * not yet used but will be useful in the future with the validation
031 * The position (optional) field is used to order the tags during the creation of the message
032 */
033 @Documented
034 @Retention(RetentionPolicy.RUNTIME)
035 public @interface KeyValuePairField {
036
037 /**
038 * tag identifying the field in the message (mandatory)
039 *
040 * @return int
041 */
042 int tag();
043
044 /**
045 * name of the field (optional)
046 *
047 * @return String
048 */
049 String name() default "";
050
051 /**
052 * pattern that the formater will use to transform the data (optional)
053 *
054 * @return String
055 */
056 String pattern() default "";
057
058 /**
059 *
060 * Position of the field in the message generated
061 *
062 * @return int
063 */
064 int position() default 0;
065
066 /**
067 * precision of the BigDecimal number to be created
068 *
069 * @return int
070 */
071 int precision() default 0;
072
073 boolean required() default false;
074
075 }