You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/08/07 11:14:29 UTC
[03/12] camel git commit: CAMEL-5958: Bindy ignores bean class type
(initial work)
CAMEL-5958: Bindy ignores bean class type (initial work)
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ce6bf6e6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ce6bf6e6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ce6bf6e6
Branch: refs/heads/master
Commit: ce6bf6e6feb5f425cd544c4c1edfa2eb34641907
Parents: d780324
Author: lburgazzoli <lb...@gmail.com>
Authored: Sun Oct 27 16:04:33 2013 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:05:04 2015 +0200
----------------------------------------------------------------------
.../apache/camel/builder/DataFormatClause.java | 2 +
.../camel/model/dataformat/BindyDataFormat.java | 12 +-
.../bindy/BindyAbstractDataFormat.java | 25 +--
.../dataformat/bindy/BindyAbstractFactory.java | 108 +++-------
.../camel/dataformat/bindy/BindyCsvFactory.java | 187 ++++++++---------
.../bindy/BindyFixedLengthFactory.java | 208 ++++++++-----------
.../bindy/BindyKeyValuePairFactory.java | 128 +++++-------
.../bindy/csv/BindyCsvDataFormat.java | 17 +-
.../bindy/fixed/BindyFixedLengthDataFormat.java | 33 +--
.../bindy/kvp/BindyKeyValuePairDataFormat.java | 37 ++--
.../bindy/util/AnnotationModelLoader.java | 18 +-
.../csv/BindyCarQuoteAndCommaDelimiterTest.java | 15 +-
...ndyComplexCsvGenerateHeaderMarshallTest.java | 2 +-
.../bindy/csv/BindyComplexCsvMarshallTest.java | 2 +-
.../csv/BindyComplexCsvUnmarshallTest.java | 2 +-
.../csv/BindyCsvBigFileUnmarshallTest.java | 2 +-
.../csv/BindyDoubleQuotesCsvUnmarshallTest.java | 2 +-
.../BindyInlinedQuotesCsvUnmarshallTest.java | 2 +-
.../bindy/csv/BindyPipeDelimiterTest.java | 4 +-
.../csv/BindyPojoSimpleCsvMarshallTest.java | 2 +-
...indySimpleCsvGenerateHeaderMarshallTest.java | 2 +-
...ySimpleCsvMandatoryFieldsUnmarshallTest.java | 4 +-
.../csv/BindySimpleCsvMarshallDslTest.java | 2 +-
...dySimpleCsvMarshallPositionModifiedTest.java | 2 +-
.../bindy/csv/BindySimpleCsvMarshallTest.java | 2 +-
.../csv/BindySimpleCsvMarshallTrimClipTest.java | 2 +-
.../csv/BindySimpleCsvNullMarshallTest.java | 2 +-
.../BindySimpleCsvOneToManyMarshallTest.java | 2 +-
...SimpleCsvRemoveWhitespaceUnmarshallTest.java | 2 +-
...ndySimpleCsvSkipFirstLineUnmarshallTest.java | 2 +-
.../BindySimpleCsvUnmarshallBadIntegerTest.java | 2 +-
...SimpleCsvUnmarshallPositionModifiedTest.java | 2 +-
.../bindy/csv/BindySimpleCsvUnmarshallTest.java | 2 +-
...dySingleQuoteStartWordCsvUnmarshallTest.java | 2 +-
.../csv/BindySingleQuotesCsvUnmarshallTest.java | 2 +-
.../bindy/csv/BindyTabSeparatorTest.java | 8 +-
.../csv2/BindyMarshalUnmarshalssueTest.java | 4 +-
.../bindy/csv2/BindyMarshalWithQuoteTest.java | 2 +-
.../csv2/BindyUnmarshalCommaIssue2Test.java | 2 +-
.../csv2/BindyUnmarshalCommaIssueTest.java | 2 +-
.../BindyComplexKeyValuePairStandaloneTest.java | 3 +-
...plexOneToManyKeyValuePairUnMarshallTest.java | 2 +-
.../BindySimpleKeyValuePairMarshallDslTest.java | 2 +-
.../BindySimpleKeyValuePairMarshallTest.java | 2 +-
...BindySimpleKeyValuePairNullMarshallTest.java | 2 +-
...ndySimpleKeyValuePairSortedMarshallTest.java | 2 +-
...ySimpleKeyValuePairSortedUnmarshallTest.java | 2 +-
.../BindySimpleKeyValuePairTabMarshallTest.java | 2 +-
...indySimpleKeyValuePairTabUnmarshallTest.java | 2 +-
...indySimpleKeyValuePairUnmarshallDslTest.java | 2 +-
.../BindySimpleKeyValuePairUnmarshallTest.java | 2 +-
...yValuePairWithoutSectionMarshallDslTest.java | 2 +-
.../BindySimpleFixedLengthWithLinkTest.java | 2 +-
.../BindySimpleFixedLengthMarshallTest.java | 2 +-
...eFixedLengthMarshallWithClipAndTrimTest.java | 2 +-
...dySimpleFixedLengthMarshallWithClipTest.java | 2 +-
...SimpleFixedLengthMarshallWithNoClipTest.java | 2 +-
.../BindySimpleFixedLengthUnmarshallTest.java | 2 +-
...impleFixedLengthUnmarshallTrimFieldTest.java | 2 +-
.../date/BindyDatePatternCsvUnmarshallTest.java | 2 +-
60 files changed, 374 insertions(+), 525 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index 7887b14..6e915b6 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -156,12 +156,14 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
* @param type the type of bindy data format to use
* @param packages packages to scan for Bindy annotated POJO classes
*/
+ /*
public T bindy(BindyType type, String... packages) {
BindyDataFormat bindy = new BindyDataFormat();
bindy.setType(type);
bindy.setPackages(packages);
return dataFormat(bindy);
}
+ */
/**
* Uses the Bindy data format
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
index 09fb248..28d5cd2d 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
@@ -40,8 +40,8 @@ import org.apache.camel.util.ObjectHelper;
public class BindyDataFormat extends DataFormatDefinition {
@XmlAttribute(required = true)
private BindyType type;
- @XmlAttribute
- private String[] packages;
+ //@XmlAttribute
+ //private String[] packages;
@XmlAttribute
private String classType;
@XmlAttribute
@@ -64,6 +64,7 @@ public class BindyDataFormat extends DataFormatDefinition {
this.type = type;
}
+ /*
public String[] getPackages() {
return packages;
}
@@ -74,6 +75,7 @@ public class BindyDataFormat extends DataFormatDefinition {
public void setPackages(String[] packages) {
this.packages = packages;
}
+ */
public String getClassType() {
return classType;
@@ -104,12 +106,9 @@ public class BindyDataFormat extends DataFormatDefinition {
}
protected DataFormat createDataFormat(RouteContext routeContext) {
- if (packages == null && (classType == null && clazz == null)) {
+ if (classType == null && clazz == null) {
throw new IllegalArgumentException("Either packages or classType must be specified");
}
- if (packages != null && (classType != null || clazz != null)) {
- throw new IllegalArgumentException("Only one of packages and classType must be specified");
- }
if (type == BindyType.Csv) {
setDataFormatName("bindy-csv");
@@ -131,7 +130,6 @@ public class BindyDataFormat extends DataFormatDefinition {
@Override
protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
- setProperty(camelContext, dataFormat, "packages", packages);
setProperty(camelContext, dataFormat, "locale", locale);
setProperty(camelContext, dataFormat, "classType", clazz);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
index de9877d..af4609a 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
@@ -16,15 +16,13 @@
*/
package org.apache.camel.dataformat.bindy;
+import org.apache.camel.spi.DataFormat;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.PackageScanClassResolver;
-
public abstract class BindyAbstractDataFormat implements DataFormat {
- private String[] packages;
private String locale;
private BindyAbstractFactory modelFactory;
private Class<?> classType;
@@ -32,22 +30,10 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
public BindyAbstractDataFormat() {
}
- public BindyAbstractDataFormat(String... packages) {
- this.packages = packages;
- }
-
protected BindyAbstractDataFormat(Class<?> classType) {
this.classType = classType;
}
- public String[] getPackages() {
- return packages;
- }
-
- public void setPackages(String... packages) {
- this.packages = packages;
- }
-
public Class<?> getClassType() {
return classType;
}
@@ -64,9 +50,9 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
this.locale = locale;
}
- public BindyAbstractFactory getFactory(PackageScanClassResolver resolver) throws Exception {
+ public BindyAbstractFactory getFactory() throws Exception {
if (modelFactory == null) {
- modelFactory = createModelFactory(resolver);
+ modelFactory = createModelFactory();
modelFactory.setLocale(locale);
}
return modelFactory;
@@ -76,7 +62,6 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
this.modelFactory = modelFactory;
}
- protected abstract BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception;
protected Object extractUnmarshalResult(List<Map<String, Object>> models) {
if (getClassType() != null) {
@@ -98,4 +83,6 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
return models;
}
}
+
+ protected abstract BindyAbstractFactory createModelFactory() throws Exception;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
index f514702..1694847 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
@@ -16,22 +16,23 @@
*/
package org.apache.camel.dataformat.bindy;
+import org.apache.camel.dataformat.bindy.annotation.CsvRecord;
+import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
+import org.apache.camel.dataformat.bindy.annotation.Link;
+import org.apache.camel.dataformat.bindy.annotation.Message;
+import org.apache.camel.dataformat.bindy.annotation.Section;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.lang.reflect.Field;
import java.text.NumberFormat;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.camel.dataformat.bindy.util.AnnotationModelLoader;
-import org.apache.camel.spi.PackageScanClassResolver;
-import org.apache.camel.spi.PackageScanFilter;
-import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* The {@link BindyAbstractFactory} implements what its common to all the formats
* supported by Camel Bindy
@@ -39,61 +40,29 @@ import org.slf4j.LoggerFactory;
public abstract class BindyAbstractFactory implements BindyFactory {
private static final Logger LOG = LoggerFactory.getLogger(BindyAbstractFactory.class);
protected final Map<String, List<Field>> annotatedLinkFields = new LinkedHashMap<String, List<Field>>();
- protected Set<Class<?>> models;
- protected Set<String> modelClassNames;
protected String crlf;
- private AnnotationModelLoader modelsLoader;
-
- private String[] packageNames;
private String locale;
private Class<?> type;
-
- public BindyAbstractFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
- this.modelsLoader = new AnnotationModelLoader(resolver);
- this.packageNames = packageNames;
-
- if (LOG.isDebugEnabled()) {
- for (String str : this.packageNames) {
- LOG.debug("Package name: {}", str);
- }
- }
-
- initModel();
- }
- public BindyAbstractFactory(PackageScanClassResolver resolver, Class<?> type) throws Exception {
- this.modelsLoader = new AnnotationModelLoader(resolver);
+ public BindyAbstractFactory(Class<?> type) throws Exception {
this.type = type;
if (LOG.isDebugEnabled()) {
LOG.debug("Class name: {}", type.getName());
}
-
- initModel();
- }
- public BindyAbstractFactory(PackageScanClassResolver resolver, Class<?> type, PackageScanFilter scanFilter) throws Exception {
- this.modelsLoader = new AnnotationModelLoader(resolver, scanFilter);
- this.type = type;
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class name: {}", type.getName());
+ if(!validateType(type)) {
+ throw new IllegalArgumentException("...");
}
-
+
initModel();
}
- public BindyAbstractFactory(PackageScanClassResolver resolver, String[] packageNames, PackageScanFilter scanFilter) throws Exception {
- this.modelsLoader = new AnnotationModelLoader(resolver, scanFilter);
- this.packageNames = packageNames;
-
- if (LOG.isDebugEnabled()) {
- for (String str : this.packageNames) {
- LOG.debug("Package name: {}", str);
- }
- }
-
- initModel();
+ protected boolean validateType(Class<?> type) {
+ return type.getAnnotation(CsvRecord.class) != null
+ || type.getAnnotation(Message.class) != null
+ || type.getAnnotation(Section.class) != null
+ || type.getAnnotation(FixedLengthRecord.class) != null;
}
/**
@@ -104,29 +73,6 @@ public abstract class BindyAbstractFactory implements BindyFactory {
* @throws Exception
*/
public void initModel() throws Exception {
- // Find classes defined as Model
- if (packageNames != null) {
- initModelClasses(this.packageNames);
- } else if (type != null) {
- // use the package name from the type as it may refer to types in the same package
- String pckName = type.getPackage().getName();
- initModelClasses(pckName);
-
- } else {
- throw new IllegalArgumentException("Either packagenames or type should be configured");
- }
-
- modelClassNames = new HashSet<String>();
- for (Class<?> clazz : models) {
- modelClassNames.add(clazz.getName());
- }
- }
-
- /**
- * Find all the classes defined as model
- */
- private void initModelClasses(String... packageNames) throws Exception {
- models = modelsLoader.loadModels(packageNames);
}
/**
@@ -164,6 +110,14 @@ public abstract class BindyAbstractFactory implements BindyFactory {
}
/**
+ *
+ * @return
+ */
+ protected Class<?> type() {
+ return type;
+ }
+
+ /**
* Factory method generating new instances of the model and adding them to a
* HashMap
*
@@ -174,12 +128,8 @@ public abstract class BindyAbstractFactory implements BindyFactory {
public Map<String, Object> factory() throws Exception {
Map<String, Object> mapModel = new HashMap<String, Object>();
- for (Class<?> cl : models) {
- Object obj = ObjectHelper.newInstance(cl);
-
- // Add instance of the class to the Map Model
- mapModel.put(obj.getClass().getName(), obj);
- }
+ Object obj = ObjectHelper.newInstance(type);
+ mapModel.put(obj.getClass().getName(), obj);
return mapModel;
}
@@ -190,7 +140,7 @@ public abstract class BindyAbstractFactory implements BindyFactory {
* @return true if the model supports the identified classes
*/
public boolean supportsModel(Set<String> classes) {
- return modelClassNames.containsAll(classes);
+ return classes.contains(type);
}
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
index 16a4263..389ede2 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
@@ -34,7 +34,6 @@ import org.apache.camel.dataformat.bindy.annotation.OneToMany;
import org.apache.camel.dataformat.bindy.annotation.Section;
import org.apache.camel.dataformat.bindy.format.FormatException;
import org.apache.camel.dataformat.bindy.util.ConverterUtils;
-import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,15 +67,8 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
private boolean quoting;
private boolean autospanLine;
- public BindyCsvFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
- super(resolver, packageNames);
-
- // initialize specific parameters of the csv model
- initCsvModel();
- }
-
- public BindyCsvFactory(PackageScanClassResolver resolver, Class<?> type) throws Exception {
- super(resolver, type);
+ public BindyCsvFactory(Class<?> type) throws Exception {
+ super(type);
// initialize specific parameters of the csv model
initCsvModel();
@@ -104,58 +96,57 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
public void initAnnotatedFields() {
maxpos = 0;
- for (Class<?> cl : models) {
- List<Field> linkFields = new ArrayList<Field>();
+ Class<?> cl = type();
+ List<Field> linkFields = new ArrayList<Field>();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class retrieved: {}", cl.getName());
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class retrieved: {}", cl.getName());
+ }
- for (Field field : cl.getDeclaredFields()) {
- DataField dataField = field.getAnnotation(DataField.class);
- if (dataField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Position defined in the class: {}, position: {}, Field: {}",
- new Object[]{cl.getName(), dataField.pos(), dataField});
- }
+ for (Field field : cl.getDeclaredFields()) {
+ DataField dataField = field.getAnnotation(DataField.class);
+ if (dataField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Position defined in the class: {}, position: {}, Field: {}",
+ new Object[]{cl.getName(), dataField.pos(), dataField});
+ }
- if (dataField.required()) {
- ++numberMandatoryFields;
- } else {
- ++numberOptionalFields;
- }
+ if (dataField.required()) {
+ ++numberMandatoryFields;
+ } else {
+ ++numberOptionalFields;
+ }
- int pos = dataField.pos();
- if (annotatedFields.containsKey(pos)) {
- Field f = annotatedFields.get(pos);
- LOG.warn("Potentially invalid model: existing @DataField '{}' replaced by '{}'", f.getName(), field.getName());
- }
- dataFields.put(pos, dataField);
- annotatedFields.put(pos, field);
- maxpos = Math.max(maxpos, pos);
+ int pos = dataField.pos();
+ if (annotatedFields.containsKey(pos)) {
+ Field f = annotatedFields.get(pos);
+ LOG.warn("Potentially invalid model: existing @DataField '{}' replaced by '{}'", f.getName(), field.getName());
}
+ dataFields.put(pos, dataField);
+ annotatedFields.put(pos, field);
+ maxpos = Math.max(maxpos, pos);
+ }
- Link linkField = field.getAnnotation(Link.class);
+ Link linkField = field.getAnnotation(Link.class);
- if (linkField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
- }
- linkFields.add(field);
+ if (linkField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
}
+ linkFields.add(field);
}
+ }
- if (!linkFields.isEmpty()) {
- annotatedLinkFields.put(cl.getName(), linkFields);
- }
+ if (!linkFields.isEmpty()) {
+ annotatedLinkFields.put(cl.getName(), linkFields);
+ }
- totalFields = numberMandatoryFields + numberOptionalFields;
+ totalFields = numberMandatoryFields + numberOptionalFields;
- if (LOG.isDebugEnabled()) {
- LOG.debug("Number of optional fields: {}", numberOptionalFields);
- LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
- LOG.debug("Total: {}", totalFields);
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Number of optional fields: {}", numberOptionalFields);
+ LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
+ LOG.debug("Total: {}", totalFields);
}
if (annotatedFields.size() < maxpos) {
@@ -254,20 +245,18 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
LOG.debug("Separator converted: '0x{}', from: {}", Integer.toHexString(separator), this.getSeparator());
}
- for (Class<?> clazz : models) {
- if (model.containsKey(clazz.getName())) {
+ Class<?> clazz = type();
+ if (model.containsKey(clazz.getName())) {
- Object obj = model.get(clazz.getName());
-
- if (obj != null && LOG.isDebugEnabled()) {
- LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
- }
- if (obj != null) {
+ Object obj = model.get(clazz.getName());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
+ }
+ if (obj != null) {
- // Generate Csv table
- generateCsvPositionMap(clazz, obj, results);
+ // Generate Csv table
+ generateCsvPositionMap(clazz, obj, results);
- }
}
}
@@ -526,60 +515,60 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
*/
private void initCsvRecordParameters() {
if (separator == null) {
- for (Class<?> cl : models) {
+ Class<?> cl = type();
- // Get annotation @CsvRecord from the class
- CsvRecord record = cl.getAnnotation(CsvRecord.class);
+ // Get annotation @CsvRecord from the class
+ CsvRecord record = cl.getAnnotation(CsvRecord.class);
- // Get annotation @Section from the class
- Section section = cl.getAnnotation(Section.class);
+ // Get annotation @Section from the class
+ Section section = cl.getAnnotation(Section.class);
- if (record != null) {
- LOG.debug("Csv record: {}", record);
+ if (record != null) {
+ LOG.debug("Csv record: {}", record);
- // Get skipFirstLine parameter
- skipFirstLine = record.skipFirstLine();
- LOG.debug("Skip First Line parameter of the CSV: {}" + skipFirstLine);
+ // Get skipFirstLine parameter
+ skipFirstLine = record.skipFirstLine();
+ LOG.debug("Skip First Line parameter of the CSV: {}" + skipFirstLine);
- // Get generateHeaderColumnNames parameter
- generateHeaderColumnNames = record.generateHeaderColumns();
- LOG.debug("Generate header column names parameter of the CSV: {}", generateHeaderColumnNames);
+ // Get generateHeaderColumnNames parameter
+ generateHeaderColumnNames = record.generateHeaderColumns();
+ LOG.debug("Generate header column names parameter of the CSV: {}", generateHeaderColumnNames);
- // Get Separator parameter
- ObjectHelper.notNull(record.separator(), "No separator has been defined in the @Record annotation");
- separator = record.separator();
- LOG.debug("Separator defined for the CSV: {}", separator);
+ // Get Separator parameter
+ ObjectHelper.notNull(record.separator(), "No separator has been defined in the @Record annotation");
+ separator = record.separator();
+ LOG.debug("Separator defined for the CSV: {}", separator);
- // Get carriage return parameter
- crlf = record.crlf();
- LOG.debug("Carriage return defined for the CSV: {}", crlf);
+ // Get carriage return parameter
+ crlf = record.crlf();
+ LOG.debug("Carriage return defined for the CSV: {}", crlf);
- // Get isOrdered parameter
- messageOrdered = record.isOrdered();
- LOG.debug("Must CSV record be ordered: {}", messageOrdered);
+ // Get isOrdered parameter
+ messageOrdered = record.isOrdered();
+ LOG.debug("Must CSV record be ordered: {}", messageOrdered);
- if (ObjectHelper.isNotEmpty(record.quote())) {
- quote = record.quote();
- LOG.debug("Quoting columns with: {}", quote);
- }
+ if (ObjectHelper.isNotEmpty(record.quote())) {
+ quote = record.quote();
+ LOG.debug("Quoting columns with: {}", quote);
+ }
- quoting = record.quoting();
- LOG.debug("CSV will be quoted: {}", quoting);
+ quoting = record.quoting();
+ LOG.debug("CSV will be quoted: {}", quoting);
- autospanLine = record.autospanLine();
- LOG.debug("Autospan line in last record: {}", autospanLine);
- }
+ autospanLine = record.autospanLine();
+ LOG.debug("Autospan line in last record: {}", autospanLine);
+ }
- if (section != null) {
- // Test if section number is not null
- ObjectHelper.notNull(section.number(), "No number has been defined for the section");
+ if (section != null) {
+ // Test if section number is not null
+ ObjectHelper.notNull(section.number(), "No number has been defined for the section");
- // Get section number and add it to the sections
- sections.put(cl.getName(), section.number());
- }
+ // Get section number and add it to the sections
+ sections.put(cl.getName(), section.number());
}
}
}
+
/**
* Set the default values for the non defined fields.
* @param model the model which has its default fields set.
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
index 2220adc..e44432b 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
@@ -65,30 +65,13 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
private int recordLength;
private boolean ignoreTrailingChars;
- public BindyFixedLengthFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
- super(resolver, packageNames);
-
- // initialize specific parameters of the fixed length model
- initFixedLengthModel();
- }
-
- public BindyFixedLengthFactory(PackageScanClassResolver resolver, PackageScanFilter scanFilter, String... packageNames) throws Exception {
- super(resolver, packageNames, scanFilter);
- initFixedLengthModel();
- }
-
- public BindyFixedLengthFactory(PackageScanClassResolver resolver, Class<?> type) throws Exception {
- super(resolver, type);
+ public BindyFixedLengthFactory(Class<?> type) throws Exception {
+ super(type);
// initialize specific parameters of the fixed length model
initFixedLengthModel();
}
- public BindyFixedLengthFactory(PackageScanClassResolver resolver, PackageScanFilter scanFilter, Class<?> type) throws Exception {
- super(resolver, type, scanFilter);
- initFixedLengthModel();
- }
-
/**
* method uses to initialize the model representing the classes who will
* bind the data. This process will scan for classes according to the
@@ -105,56 +88,52 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
}
public void initAnnotatedFields() {
+ Class<?> cl = type();
+ List<Field> linkFields = new ArrayList<Field>();
- for (Class<?> cl : models) {
-
- List<Field> linkFields = new ArrayList<Field>();
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class retrieved: {}", cl.getName());
- }
-
- for (Field field : cl.getDeclaredFields()) {
- DataField dataField = field.getAnnotation(DataField.class);
- if (dataField != null) {
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Position defined in the class: {}, position: {}, Field: {}", new Object[]{cl.getName(), dataField.pos(), dataField});
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class retrieved: {}", cl.getName());
+ }
- if (dataField.required()) {
- ++numberMandatoryFields;
- } else {
- ++numberOptionalFields;
- }
+ for (Field field : cl.getDeclaredFields()) {
+ DataField dataField = field.getAnnotation(DataField.class);
+ if (dataField != null) {
- dataFields.put(dataField.pos(), dataField);
- annotatedFields.put(dataField.pos(), field);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Position defined in the class: {}, position: {}, Field: {}", new Object[]{cl.getName(), dataField.pos(), dataField});
}
- Link linkField = field.getAnnotation(Link.class);
-
- if (linkField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
- }
- linkFields.add(field);
+ if (dataField.required()) {
+ ++numberMandatoryFields;
+ } else {
+ ++numberOptionalFields;
}
+ dataFields.put(dataField.pos(), dataField);
+ annotatedFields.put(dataField.pos(), field);
}
- if (!linkFields.isEmpty()) {
- annotatedLinkFields.put(cl.getName(), linkFields);
+ Link linkField = field.getAnnotation(Link.class);
+
+ if (linkField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
+ }
+ linkFields.add(field);
}
- totalFields = numberMandatoryFields + numberOptionalFields;
+ }
- if (LOG.isDebugEnabled()) {
- LOG.debug("Number of optional fields: {}", numberOptionalFields);
- LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
- LOG.debug("Total: {}", totalFields);
- }
+ if (!linkFields.isEmpty()) {
+ annotatedLinkFields.put(cl.getName(), linkFields);
+ }
+
+ totalFields = numberMandatoryFields + numberOptionalFields;
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Number of optional fields: {}", numberOptionalFields);
+ LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
+ LOG.debug("Total: {}", totalFields);
}
}
@@ -298,23 +277,21 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
StringBuilder buffer = new StringBuilder();
Map<Integer, List<String>> results = new HashMap<Integer, List<String>>();
- for (Class<?> clazz : models) {
+ Class<?> clazz = type();
+ if (model.containsKey(clazz.getName())) {
- if (model.containsKey(clazz.getName())) {
+ Object obj = model.get(clazz.getName());
- Object obj = model.get(clazz.getName());
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
+ }
- if (obj != null) {
+ if (obj != null) {
- // Generate Fixed Length table
- // containing the positions of the fields
- generateFixedLengthPositionMap(clazz, obj, results);
+ // Generate Fixed Length table
+ // containing the positions of the fields
+ generateFixedLengthPositionMap(clazz, obj, results);
- }
}
}
@@ -466,54 +443,53 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
*/
private void initFixedLengthRecordParameters() {
- for (Class<?> cl : models) {
-
- // Get annotation @FixedLengthRecord from the class
- FixedLengthRecord record = cl.getAnnotation(FixedLengthRecord.class);
-
- if (record != null) {
- LOG.debug("Fixed length record: {}", record);
-
- // Get carriage return parameter
- crlf = record.crlf();
- LOG.debug("Carriage return defined for the CSV: {}", crlf);
-
- // Get hasHeader parameter
- hasHeader = record.hasHeader();
- LOG.debug("Has Header: {}", hasHeader);
-
- // Get skipHeader parameter
- skipHeader = record.skipHeader();
- LOG.debug("Skip Header: {}", skipHeader);
-
- // Get hasFooter parameter
- hasFooter = record.hasFooter();
- LOG.debug("Has Footer: {}", hasFooter);
-
- // Get skipFooter parameter
- skipFooter = record.skipFooter();
- LOG.debug("Skip Footer: {}", skipFooter);
-
- // Get isHeader parameter
- isHeader = record.isHeader();
- LOG.debug("Is Header: {}", isHeader);
-
- // Get isFooter parameter
- isFooter = record.isFooter();
- LOG.debug("Is Footer: {}", isFooter);
-
- // Get padding character
- paddingChar = record.paddingChar();
- LOG.debug("Padding char: {}", paddingChar);
-
- // Get length of the record
- recordLength = record.length();
- LOG.debug("Length of the record: {}", recordLength);
-
- // Get flag for ignore trailing characters
- ignoreTrailingChars = record.ignoreTrailingChars();
- LOG.debug("Ignore trailing chars: {}", ignoreTrailingChars);
- }
+ Class<?> cl = type();
+
+ // Get annotation @FixedLengthRecord from the class
+ FixedLengthRecord record = cl.getAnnotation(FixedLengthRecord.class);
+
+ if (record != null) {
+ LOG.debug("Fixed length record: {}", record);
+
+ // Get carriage return parameter
+ crlf = record.crlf();
+ LOG.debug("Carriage return defined for the CSV: {}", crlf);
+
+ // Get hasHeader parameter
+ hasHeader = record.hasHeader();
+ LOG.debug("Has Header: {}", hasHeader);
+
+ // Get skipHeader parameter
+ skipHeader = record.skipHeader();
+ LOG.debug("Skip Header: {}", skipHeader);
+
+ // Get hasFooter parameter
+ hasFooter = record.hasFooter();
+ LOG.debug("Has Footer: {}", hasFooter);
+
+ // Get skipFooter parameter
+ skipFooter = record.skipFooter();
+ LOG.debug("Skip Footer: {}", skipFooter);
+
+ // Get isHeader parameter
+ isHeader = record.isHeader();
+ LOG.debug("Is Header: {}", isHeader);
+
+ // Get isFooter parameter
+ isFooter = record.isFooter();
+ LOG.debug("Is Footer: {}", isFooter);
+
+ // Get padding character
+ paddingChar = record.paddingChar();
+ LOG.debug("Padding char: {}", paddingChar);
+
+ // Get length of the record
+ recordLength = record.length();
+ LOG.debug("Length of the record: {}", recordLength);
+
+ // Get flag for ignore trailing characters
+ ignoreTrailingChars = record.ignoreTrailingChars();
+ LOG.debug("Ignore trailing chars: {}", ignoreTrailingChars);
}
if (hasHeader && isHeader) {
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
index 020820a..9418f40 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
@@ -55,15 +55,9 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
private String pairSeparator;
private boolean messageOrdered;
- public BindyKeyValuePairFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
- super(resolver, packageNames);
- // Initialize what is specific to Key Value Pair model
- initKeyValuePairModel();
- }
-
- public BindyKeyValuePairFactory(PackageScanClassResolver resolver, Class<?> type) throws Exception {
- super(resolver, type);
+ public BindyKeyValuePairFactory(Class<?> type) throws Exception {
+ super(type);
// Initialize what is specific to Key Value Pair model
initKeyValuePairModel();
@@ -89,34 +83,31 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
public void initAnnotatedFields() {
- for (Class<?> cl : models) {
+ Class<?> cl = type();
+ List<Field> linkFields = new ArrayList<Field>();
- List<Field> linkFields = new ArrayList<Field>();
-
- for (Field field : cl.getDeclaredFields()) {
- KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
- if (keyValuePairField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Key declared in the class : {}, key : {}, Field : {}", new Object[]{cl.getName(), keyValuePairField.tag(), keyValuePairField});
- }
- keyValuePairFields.put(keyValuePairField.tag(), keyValuePairField);
- annotatedFields.put(keyValuePairField.tag(), field);
+ for (Field field : cl.getDeclaredFields()) {
+ KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
+ if (keyValuePairField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Key declared in the class : {}, key : {}, Field : {}", new Object[]{cl.getName(), keyValuePairField.tag(), keyValuePairField});
}
+ keyValuePairFields.put(keyValuePairField.tag(), keyValuePairField);
+ annotatedFields.put(keyValuePairField.tag(), field);
+ }
- Link linkField = field.getAnnotation(Link.class);
+ Link linkField = field.getAnnotation(Link.class);
- if (linkField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class linked : {}, Field {}", cl.getName(), field);
- }
- linkFields.add(field);
+ if (linkField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class linked : {}, Field {}", cl.getName(), field);
}
+ linkFields.add(field);
}
+ }
- if (!linkFields.isEmpty()) {
- annotatedLinkFields.put(cl.getName(), linkFields);
- }
-
+ if (!linkFields.isEmpty()) {
+ annotatedLinkFields.put(cl.getName(), linkFields);
}
}
@@ -170,19 +161,15 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
}
- // Iterate over the model
- for (Class<?> clazz : models) {
+ Class<?> clazz = type();
+ Object obj = model.get(clazz.getName());
- Object obj = model.get(clazz.getName());
+ if (obj != null) {
- if (obj != null) {
-
- // Generate model from key value map
- generateModelFromKeyValueMap(clazz, obj, results, line, lists);
+ // Generate model from key value map
+ generateModelFromKeyValueMap(clazz, obj, results, line, lists);
- }
}
-
}
private void generateModelFromKeyValueMap(Class<?> clazz, Object obj, Map<Integer, List<String>> results, int line, Map<String, List<Object>> lists) throws Exception {
@@ -594,43 +581,40 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
*/
private void initMessageParameters() {
if ((pairSeparator == null) || (keyValuePairSeparator == null)) {
- for (Class<?> cl : models) {
- // Get annotation @Message from the class
- Message message = cl.getAnnotation(Message.class);
-
- // Get annotation @Section from the class
- Section section = cl.getAnnotation(Section.class);
-
- if (message != null) {
- // Get Pair Separator parameter
- ObjectHelper.notNull(message.pairSeparator(), "No Pair Separator has been defined in the @Message annotation");
- pairSeparator = message.pairSeparator();
- LOG.debug("Pair Separator defined for the message: {}", pairSeparator);
-
- // Get KeyValuePair Separator parameter
- ObjectHelper.notNull(message.keyValuePairSeparator(), "No Key Value Pair Separator has been defined in the @Message annotation");
- keyValuePairSeparator = message.keyValuePairSeparator();
- LOG.debug("Key Value Pair Separator defined for the message: {}", keyValuePairSeparator);
-
- // Get carriage return parameter
- crlf = message.crlf();
- LOG.debug("Carriage return defined for the message: {}", crlf);
-
- // Get isOrdered parameter
- messageOrdered = message.isOrdered();
- LOG.debug("Is the message ordered in output: {}", messageOrdered);
- }
+ Class<?> cl = type();
+ // Get annotation @Message from the class
+ Message message = cl.getAnnotation(Message.class);
+
+ // Get annotation @Section from the class
+ Section section = cl.getAnnotation(Section.class);
+
+ if (message != null) {
+ // Get Pair Separator parameter
+ ObjectHelper.notNull(message.pairSeparator(), "No Pair Separator has been defined in the @Message annotation");
+ pairSeparator = message.pairSeparator();
+ LOG.debug("Pair Separator defined for the message: {}", pairSeparator);
+
+ // Get KeyValuePair Separator parameter
+ ObjectHelper.notNull(message.keyValuePairSeparator(), "No Key Value Pair Separator has been defined in the @Message annotation");
+ keyValuePairSeparator = message.keyValuePairSeparator();
+ LOG.debug("Key Value Pair Separator defined for the message: {}", keyValuePairSeparator);
+
+ // Get carriage return parameter
+ crlf = message.crlf();
+ LOG.debug("Carriage return defined for the message: {}", crlf);
+
+ // Get isOrdered parameter
+ messageOrdered = message.isOrdered();
+ LOG.debug("Is the message ordered in output: {}", messageOrdered);
+ }
- if (section != null) {
- // Test if section number is not null
- ObjectHelper.notNull(section.number(), "No number has been defined for the section");
+ if (section != null) {
+ // Test if section number is not null
+ ObjectHelper.notNull(section.number(), "No number has been defined for the section");
- // Get section number and add it to the sections
- sections.put(cl.getName(), section.number());
- }
+ // Get section number and add it to the sections
+ sections.put(cl.getName(), section.number());
}
}
}
-
-
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
index d8ef0c6..a85b5fa 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
@@ -35,7 +35,6 @@ import org.apache.camel.dataformat.bindy.BindyCsvFactory;
import org.apache.camel.dataformat.bindy.annotation.Link;
import org.apache.camel.dataformat.bindy.util.ConverterUtils;
import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -51,10 +50,6 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
public BindyCsvDataFormat() {
}
- public BindyCsvDataFormat(String... packages) {
- super(packages);
- }
-
public BindyCsvDataFormat(Class<?> type) {
super(type);
}
@@ -62,7 +57,7 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
@SuppressWarnings("unchecked")
public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
- BindyCsvFactory factory = (BindyCsvFactory)getFactory(exchange.getContext().getPackageScanClassResolver());
+ BindyCsvFactory factory = (BindyCsvFactory)getFactory();
ObjectHelper.notNull(factory, "not instantiated");
// Get CRLF
@@ -117,7 +112,7 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
}
public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
- BindyCsvFactory factory = (BindyCsvFactory)getFactory(exchange.getContext().getPackageScanClassResolver());
+ BindyCsvFactory factory = (BindyCsvFactory)getFactory();
ObjectHelper.notNull(factory, "not instantiated");
// List of Pojos
@@ -313,11 +308,7 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
}
@Override
- protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
- if (getClassType() != null) {
- return new BindyCsvFactory(resolver, getClassType());
- } else {
- return new BindyCsvFactory(resolver, getPackages());
- }
+ protected BindyAbstractFactory createModelFactory() throws Exception {
+ return new BindyCsvFactory(getClassType());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
index 180b982..e65c715 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
@@ -60,10 +60,6 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
public BindyFixedLengthDataFormat() {
}
- public BindyFixedLengthDataFormat(String... packages) {
- super(packages);
- }
-
public BindyFixedLengthDataFormat(Class<?> type) {
super(type);
}
@@ -71,7 +67,7 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
@SuppressWarnings("unchecked")
public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
PackageScanClassResolver resolver = exchange.getContext().getPackageScanClassResolver();
- BindyFixedLengthFactory factory = (BindyFixedLengthFactory) getFactory(resolver);
+ BindyFixedLengthFactory factory = (BindyFixedLengthFactory) getFactory();
ObjectHelper.notNull(factory, "not instantiated");
// Get CRLF
@@ -153,7 +149,7 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
PackageScanClassResolver resolver = exchange.getContext().getPackageScanClassResolver();
- BindyFixedLengthFactory factory = (BindyFixedLengthFactory) getFactory(resolver);
+ BindyFixedLengthFactory factory = (BindyFixedLengthFactory) getFactory();
ObjectHelper.notNull(factory, "not instantiated");
// List of Pojos
@@ -269,7 +265,7 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
}
@Override
- protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
+ protected BindyAbstractFactory createModelFactory() throws Exception {
// Initialize the primary (body) model factory ignoring header and footer model classes
PackageScanFilter defaultRecordScanFilter = new PackageScanFilter() {
@@ -280,12 +276,7 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
}
};
- BindyFixedLengthFactory factory;
- if (getClassType() != null) {
- factory = new BindyFixedLengthFactory(resolver, defaultRecordScanFilter, getClassType());
- } else {
- factory = new BindyFixedLengthFactory(resolver, defaultRecordScanFilter, getPackages());
- }
+ BindyFixedLengthFactory factory = new BindyFixedLengthFactory(getClassType());
// Optionally initialize the header factory... using header model classes
if (factory.hasHeader()) {
@@ -296,12 +287,9 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
return record != null && record.isHeader();
}
};
-
- if (getClassType() != null) {
- this.headerFactory = new BindyFixedLengthFactory(resolver, headerScanFilter, getClassType());
- } else {
- this.headerFactory = new BindyFixedLengthFactory(resolver, headerScanFilter, getPackages());
- }
+
+ this.headerFactory = new BindyFixedLengthFactory(getClassType());
+
}
// Optionally initialize the footer factory... using footer model classes
@@ -315,11 +303,8 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
}
};
- if (getClassType() != null) {
- this.footerFactory = new BindyFixedLengthFactory(resolver, footerScanFilter, getClassType());
- } else {
- this.footerFactory = new BindyFixedLengthFactory(resolver, footerScanFilter, getPackages());
- }
+ this.footerFactory = new BindyFixedLengthFactory(getClassType());
+
}
return factory;
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
index f6cc146..f9fad09 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
@@ -16,28 +16,27 @@
*/
package org.apache.camel.dataformat.bindy.kvp;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-
import org.apache.camel.Exchange;
import org.apache.camel.dataformat.bindy.BindyAbstractDataFormat;
import org.apache.camel.dataformat.bindy.BindyAbstractFactory;
import org.apache.camel.dataformat.bindy.BindyKeyValuePairFactory;
import org.apache.camel.dataformat.bindy.util.ConverterUtils;
import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+
/**
* A <a href="http://camel.apache.org/data-format.html">data format</a> (
* {@link DataFormat}) using Bindy to marshal to and from CSV files
@@ -49,17 +48,13 @@ public class BindyKeyValuePairDataFormat extends BindyAbstractDataFormat {
public BindyKeyValuePairDataFormat() {
}
- public BindyKeyValuePairDataFormat(String... packages) {
- super(packages);
- }
-
public BindyKeyValuePairDataFormat(Class<?> type) {
super(type);
}
@SuppressWarnings("unchecked")
public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
- BindyAbstractFactory factory = getFactory(exchange.getContext().getPackageScanClassResolver());
+ BindyAbstractFactory factory = getFactory();
List<Map<String, Object>> models = (ArrayList<Map<String, Object>>)body;
byte[] crlf;
@@ -77,7 +72,7 @@ public class BindyKeyValuePairDataFormat extends BindyAbstractDataFormat {
}
public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
- BindyKeyValuePairFactory factory = (BindyKeyValuePairFactory)getFactory(exchange.getContext().getPackageScanClassResolver());
+ BindyKeyValuePairFactory factory = (BindyKeyValuePairFactory)getFactory();
// List of Pojos
List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();
@@ -151,11 +146,7 @@ public class BindyKeyValuePairDataFormat extends BindyAbstractDataFormat {
}
}
- protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
- if (getClassType() != null) {
- return new BindyKeyValuePairFactory(resolver, getClassType());
- } else {
- return new BindyKeyValuePairFactory(resolver, getPackages());
- }
+ protected BindyAbstractFactory createModelFactory() throws Exception {
+ return new BindyKeyValuePairFactory(getClassType());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
index ae3e1f9..7c86d4e 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
@@ -35,7 +35,7 @@ import org.apache.camel.spi.PackageScanFilter;
public class AnnotationModelLoader {
private PackageScanClassResolver resolver;
- private PackageScanFilter filter;
+ //private PackageScanFilter filter;
private Set<Class<? extends Annotation>> annotations;
public AnnotationModelLoader(PackageScanClassResolver resolver) {
@@ -48,26 +48,18 @@ public class AnnotationModelLoader {
annotations.add(Section.class);
annotations.add(FixedLengthRecord.class);
}
-
+
+ /*
public AnnotationModelLoader(PackageScanClassResolver resolver, PackageScanFilter filter) {
this(resolver);
this.filter = filter;
}
+ */
public Set<Class<?>> loadModels(String... packageNames) throws Exception {
Set<Class<?>> results = resolver.findAnnotated(annotations, packageNames);
- //TODO; this logic could be moved into the PackageScanClassResolver by creating:
- // findAnnotated(annotations, packageNames, filter)
- Set<Class<?>> resultsToRemove = new HashSet<Class<?>>();
- if (filter != null) {
- for (Class<?> clazz : results) {
- if (!filter.matches(clazz)) {
- resultsToRemove.add(clazz);
- }
- }
- }
- results.removeAll(resultsToRemove);
+
return results;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
index 5a4d051..87b67e6 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
@@ -87,17 +87,16 @@ public class BindyCarQuoteAndCommaDelimiterTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
- BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.car");
- camelDataFormat.setLocale("en");
+ BindyCsvDataFormat dataFormat = new BindyCsvDataFormat();
+ dataFormat.setClassType(org.apache.camel.dataformat.bindy.model.car.Car.class);
+ dataFormat.setLocale("en");
from("direct:out")
- .unmarshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.model.car")
- .to("mock:out");
-
+ .unmarshal().bindy(BindyType.Csv,org.apache.camel.dataformat.bindy.model.car.Car.class)
+ .to("mock:out");
from("direct:in")
- .marshal(camelDataFormat)
- .to("mock:in");
+ .marshal(dataFormat)
+ .to("mock:in");
}
};
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java
index 9e1fca1..a17b459 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java
@@ -98,7 +98,7 @@ public class BindyComplexCsvGenerateHeaderMarshallTest extends AbstractJUnit4Spr
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.complex.generateheader");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.complex.generateheader.Order.class);
camelDataFormat.setLocale("en");
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java
index 9a1d3d4..94f93ba 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java
@@ -99,7 +99,7 @@ public class BindyComplexCsvMarshallTest extends AbstractJUnit4SpringContextTest
@Override
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Order.class);
camelDataFormat.setLocale("en");
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
index c6525e2..72ca66d 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
@@ -50,7 +50,7 @@ public class BindyComplexCsvUnmarshallTest extends AbstractJUnit4SpringContextTe
public static class ContextConfig extends RouteBuilder {
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Order.class);
from("direct:start").unmarshal(camelDataFormat).to("mock:result");
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
index 3a376eb..ee8f6a9 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
@@ -53,7 +53,7 @@ public class BindyCsvBigFileUnmarshallTest extends AbstractJUnit4SpringContextTe
public static class ContextConfig extends RouteBuilder {
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
from("file://src/test/data/big?noop=true").unmarshal(camelDataFormat).to("mock:result");
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java
index c855492..fc0aebe 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java
@@ -58,7 +58,7 @@ public class BindyDoubleQuotesCsvUnmarshallTest extends AbstractJUnit4SpringCont
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.csv");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(Order.class);
public void configure() {
from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
index ba5d63c..0356209 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
@@ -64,7 +64,7 @@ public class BindyInlinedQuotesCsvUnmarshallTest extends AbstractJUnit4SpringCon
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclasssinglequote");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclasssinglequote.Order.class);
public void configure() {
from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
index 552937b..6202404 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
@@ -76,11 +76,11 @@ public class BindyPipeDelimiterTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:unmarshal")
- .unmarshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.model.simple.pipeline")
+ .unmarshal().bindy(BindyType.Csv, org.apache.camel.dataformat.bindy.model.simple.pipeline.MyData.class)
.to("mock:result");
from("direct:marshal")
- .marshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.model.simple.pipeline")
+ .marshal().bindy(BindyType.Csv, org.apache.camel.dataformat.bindy.model.simple.pipeline.MyData.class)
.to("mock:result");
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPojoSimpleCsvMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPojoSimpleCsvMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPojoSimpleCsvMarshallTest.java
index 1469937..8e39b98 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPojoSimpleCsvMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPojoSimpleCsvMarshallTest.java
@@ -94,7 +94,7 @@ public class BindyPojoSimpleCsvMarshallTest extends AbstractJUnit4SpringContextT
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
camelDataFormat.setLocale("en");
Tracer tracer = new Tracer();
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java
index f5b9c29..5dbfdba 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java
@@ -86,7 +86,7 @@ public class BindySimpleCsvGenerateHeaderMarshallTest extends AbstractJUnit4Spri
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassgenerateheader");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassgenerateheader.Order.class);
camelDataFormat.setLocale("en");
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
index d90a545..0799792 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
@@ -164,8 +164,8 @@ public class BindySimpleCsvMandatoryFieldsUnmarshallTest extends AbstractJUnit4S
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat formatOptional = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
- BindyCsvDataFormat formatMandatory = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassmandatory");
+ BindyCsvDataFormat formatOptional = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
+ BindyCsvDataFormat formatMandatory = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassmandatory.Order.class);
public void configure() {
from("direct:start1").unmarshal(formatOptional).to("mock:result1");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
index 902a4e6..25fa9cc 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
@@ -95,7 +95,7 @@ public class BindySimpleCsvMarshallDslTest extends AbstractJUnit4SpringContextTe
public void configure() {
BindyDataFormat bindy = new BindyDataFormat();
bindy.setLocale("en");
- bindy.setPackages(new String[] {"org.apache.camel.dataformat.bindy.model.simple.oneclass"});
+ bindy.setClassType(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
bindy.setType(BindyType.Csv);
from("direct:start").
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java
index c264511..aaf431f 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java
@@ -86,7 +86,7 @@ public class BindySimpleCsvMarshallPositionModifiedTest extends CommonBindyTest
getContext().addInterceptStrategy(tracer);
- BindyCsvDataFormat csvBindyDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassdifferentposition");
+ BindyCsvDataFormat csvBindyDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassdifferentposition.Order.class);
csvBindyDataFormat.setLocale("en");
// default should errors go to mock:error
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
index c40e084..b4f98ff 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
@@ -109,7 +109,7 @@ public class BindySimpleCsvMarshallTest extends AbstractJUnit4SpringContextTests
getContext().addInterceptStrategy(tracer);
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
camelDataFormat.setLocale("en");
// default should errors go to mock:error
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTrimClipTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTrimClipTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTrimClipTest.java
index 28d1ca8..171298b 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTrimClipTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTrimClipTest.java
@@ -64,7 +64,7 @@ public class BindySimpleCsvMarshallTrimClipTest extends AbstractJUnit4SpringCont
public static class ContextConfig extends RouteBuilder {
public void configure() {
BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(
- "org.apache.camel.dataformat.bindy.model.simple.oneclassandtrimandclip");
+ org.apache.camel.dataformat.bindy.model.simple.oneclassandtrimandclip.Customer.class);
from(URI_DIRECT_START).marshal(camelDataFormat).to(URI_MOCK_RESULT);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
index e1b62bb..3b2de59 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
@@ -84,7 +84,7 @@ public class BindySimpleCsvNullMarshallTest extends AbstractJUnit4SpringContextT
public static class ContextConfig extends RouteBuilder {
public void configure() {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
camelDataFormat.setLocale("en");
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java
index 08faa2d..eb562e0 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java
@@ -105,7 +105,7 @@ public class BindySimpleCsvOneToManyMarshallTest extends AbstractJUnit4SpringCon
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.onetomany");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.onetomany.Author.class);
public void configure() {
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
index c33b5d6..6260d47 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
@@ -54,7 +54,7 @@ public class BindySimpleCsvRemoveWhitespaceUnmarshallTest extends AbstractJUnit4
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassandremovewhitespace");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassandremovewhitespace.Order.class);
public void configure() {
// from("file://src/test/data2")
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
index 1662ec5..388074d 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
@@ -50,7 +50,7 @@ public class BindySimpleCsvSkipFirstLineUnmarshallTest extends AbstractJUnit4Spr
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassandskipfirstline");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassandskipfirstline.Order.class);
public void configure() {
// from("file://src/test/data2")