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
025 * value pair field The tag (mandatory) identifies the key of the key value pair
026 * (e.g. 8 equals the begin string in FIX The name (optional) could be used in
027 * the future to bind a property which a different name The pattern (optional)
028 * allows to define the pattern of the data (useful for Date, BigDecimal ...)
029 * The precision (optional) reflects the precision to be used with BigDecimal
030 * number The required (optional) field allows to define if the field is
031 * required or not. This property is not yet used but will be useful in the
032 * future with the validation The position (optional) field is used to order the
033 * tags during the creation of the message
034 */
035 @Documented
036 @Retention(RetentionPolicy.RUNTIME)
037 public @interface KeyValuePairField {
038
039 /**
040 * tag identifying the field in the message (mandatory)
041 *
042 * @return int
043 */
044 int tag();
045
046 /**
047 * name of the field (optional)
048 *
049 * @return String
050 */
051 String name() default "";
052
053 /**
054 * pattern that the formater will use to transform the data (optional)
055 *
056 * @return String
057 */
058 String pattern() default "";
059
060 /**
061 * Position of the field in the message generated
062 *
063 * @return int
064 */
065 int position() default 0;
066
067 /**
068 * precision of the BigDecimal number to be created
069 *
070 * @return int
071 */
072 int precision() default 0;
073
074 boolean required() default false;
075
076 }