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 * This annotation represents the root class of the model. When a CSV,
025 * fixed-length record must be described in the model we will use this
026 * annotation and the separator (for csv record) to know how to split the data
027 * during the unmarshal process The separator (mandatory) The name is optional
028 * and could be used in the future to bind a property which a different name The
029 * skipfirstline (optional) allows to skip the first line of the file/content
030 * received The generateHeaderColumnNames (optional) allow to add in the CSV
031 * generated the header containing names of the columns The crlf (optional) is
032 * used to add a new line after a record. By default, the value is WINDOWS The
033 * isOrdered (optional) boolean is used to ordered the message generated in
034 * output
035 */
036 @Documented
037 @Retention(RetentionPolicy.RUNTIME)
038 public @interface CsvRecord {
039
040 /**
041 * Name describing the record (optional)
042 *
043 * @return String
044 */
045 String name() default "";
046
047 /**
048 * Separator used to split a record in tokens (mandatory)
049 *
050 * @return String
051 */
052 String separator();
053
054 /**
055 * The skipFirstLine parameter will allow to skip or not the first line of a
056 * CSV file. This line often contains columns definition
057 *
058 * @return boolean
059 */
060 boolean skipFirstLine() default false;
061
062 /**
063 * Character to be used to add a carriage return after each record
064 * (optional) Three values can be used : WINDOWS, UNIX or MAC
065 *
066 * @return String
067 */
068 String crlf() default "WINDOWS";
069
070 /**
071 * The generateHeaderColumns parameter allow to add in the CSV generated the
072 * header containing names of the columns
073 *
074 * @return boolean
075 */
076 boolean generateHeaderColumns() default false;
077
078 /**
079 * Indicates if the message must be ordered in output
080 *
081 * @return boolean
082 */
083 boolean isOrdered() default false;
084
085 }