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 String name() default "";
044
045 /**
046 * Separator used to split a record in tokens (mandatory)
047 */
048 String separator();
049
050 /**
051 * The skipFirstLine parameter will allow to skip or not the first line of a
052 * CSV file. This line often contains columns definition
053 */
054 boolean skipFirstLine() default false;
055
056 /**
057 * Character to be used to add a carriage return after each record
058 * (optional) Three values can be used : WINDOWS, UNIX or MAC.
059 */
060 String crlf() default "WINDOWS";
061
062 /**
063 * The generateHeaderColumns parameter allow to add in the CSV generated the
064 * header containing names of the columns
065 */
066 boolean generateHeaderColumns() default false;
067
068 /**
069 * Indicates if the message must be ordered in output
070 */
071 boolean isOrdered() default false;
072
073 /**
074 * Whether to marshal columns with the given quote character (optional)
075 */
076 String quote() default "";
077
078 }