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 field of
025 * a record (csv, ...).
026 * The pos (mandatory) identifies the position of the data in the record
027 * The name is optional and could be used in the future to bind a property which a different name
028 * The pattern (optional) allows to define the pattern of the data (useful for Date, ...)
029 * The length (optional) allows to define for fixed length message the size of the data's block
030 * The precision(optional) reflects the precision to be used with BigDecimal number
031 * The position (optional) identify the position of the field in the CSV generated
032 * The required (optional) property identifies a field which is mandatory.
033 */
034 @Documented
035 @Retention(RetentionPolicy.RUNTIME)
036 public @interface DataField {
037
038 /**
039 * position of the data in the record (mandatory)
040 *
041 * @return int
042 */
043 int pos();
044
045 /**
046 * name of the field (optional)
047 *
048 * @return String
049 */
050 String name() default "";
051
052 /**
053 * pattern that the formater will use to transform the data (optional)
054 *
055 * @return String
056 */
057 String pattern() default "";
058
059 /**
060 * length of the data block (useful for the fixedlength record) (optional in
061 * this version)
062 *
063 * @return int
064 */
065 int length() 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 /**
075 *
076 * Position of the field in the message generated
077 *
078 * @return int
079 */
080 int position() default 0;
081
082 /**
083 *
084 * Indicates if the field is mandatory
085 *
086 * @return boolean
087 */
088 boolean required() default false;
089
090 }