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 */
017package org.apache.camel.model.dataformat;
018
019import javax.xml.bind.annotation.XmlAccessType;
020import javax.xml.bind.annotation.XmlAccessorType;
021import javax.xml.bind.annotation.XmlAttribute;
022import javax.xml.bind.annotation.XmlRootElement;
023import javax.xml.bind.annotation.XmlTransient;
024
025import org.apache.camel.model.DataFormatDefinition;
026import org.apache.camel.spi.Metadata;
027
028/**
029 * The Bindy data format is used for working with flat payloads (such as CSV,
030 * delimited, fixed length formats, or FIX messages).
031 */
032@Metadata(firstVersion = "2.0.0", label = "dataformat,transformation,csv", title = "Bindy")
033@XmlRootElement(name = "bindy")
034@XmlAccessorType(XmlAccessType.FIELD)
035public class BindyDataFormat extends DataFormatDefinition {
036    @XmlAttribute(required = true)
037    private BindyType type;
038    @XmlAttribute
039    private String classType;
040    @XmlAttribute
041    private String locale;
042    @XmlAttribute
043    @Metadata(defaultValue = "true")
044    private Boolean unwrapSingleInstance;
045    @XmlTransient
046    private Class<?> clazz;
047
048    public BindyDataFormat() {
049        super("bindy");
050    }
051
052    public BindyType getType() {
053        return type;
054    }
055
056    /**
057     * Whether to use Csv, Fixed, or KeyValue.
058     */
059    public void setType(BindyType type) {
060        this.type = type;
061    }
062
063    public String getClassTypeAsString() {
064        return classType;
065    }
066
067    /**
068     * Name of model class to use.
069     */
070    public void setClassTypeAsString(String classType) {
071        this.classType = classType;
072    }
073
074    /**
075     * Name of model class to use.
076     */
077    public void setClassType(Class<?> classType) {
078        this.clazz = classType;
079    }
080
081    public Class<?> getClassType() {
082        return clazz;
083    }
084
085    public String getLocale() {
086        return locale;
087    }
088
089    /**
090     * To configure a default locale to use, such as <tt>us</tt> for united
091     * states.
092     * <p/>
093     * To use the JVM platform default locale then use the name <tt>default</tt>
094     */
095    public void setLocale(String locale) {
096        this.locale = locale;
097    }
098
099    public Boolean getUnwrapSingleInstance() {
100        return unwrapSingleInstance;
101    }
102
103    /**
104     * When unmarshalling should a single instance be unwrapped and returned
105     * instead of wrapped in a <tt>java.util.List</tt>.
106     */
107    public void setUnwrapSingleInstance(Boolean unwrapSingleInstance) {
108        this.unwrapSingleInstance = unwrapSingleInstance;
109    }
110
111}