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
028 * The separator (mandatory)
029 * The name is optional and could be used in the future to bind a property which a different name
030 * The skipfirstline (optional) allows to skip the first line of the file/content received
031 * The crlf (optional) is used to add a new line after a record. By default, the value is WINDOWS
032 */
033 @Documented
034 @Retention(RetentionPolicy.RUNTIME)
035 public @interface CsvRecord {
036
037 /**
038 * Name describing the record (optional)
039 *
040 * @return String
041 */
042 String name() default "";
043
044 /**
045 * Separator used to split a record in tokens (mandatory)
046 *
047 * @return String
048 */
049 String separator();
050
051 /**
052 * The skipFirstLine parameter will allow to skip or not the first line of a
053 * CSV file. This line often contains columns definition
054 *
055 * @return boolean
056 */
057 boolean skipFirstLine() default false;
058
059 /**
060 * Character to be used to add a carriage return after each record (optional)
061 * Three values can be used : WINDOWS, UNIX or MAC
062 *
063 * @return String
064 */
065 String crlf() default "WINDOWS";
066
067 }