Java 类org.apache.camel.dataformat.bindy.annotation.CsvRecord 实例源码

项目:Camel    文件:AnnotationModelLoader.java   
public AnnotationModelLoader(PackageScanClassResolver resolver) {
    this.resolver = resolver;

    annotations = new LinkedHashSet<Class<? extends Annotation>>();
    annotations.add(CsvRecord.class);
    annotations.add(Link.class);
    annotations.add(Message.class);
    annotations.add(Section.class);
    annotations.add(FixedLengthRecord.class);
}
项目:Camel    文件:BindyCsvFactory.java   
/**
 * Get parameters defined in @CsvRecord annotation
 */
private void initCsvRecordParameters() {
    if (separator == null) {
        for (Class<?> cl : models) {

            // Get annotation @CsvRecord from the class
            CsvRecord record = cl.getAnnotation(CsvRecord.class);

            // Get annotation @Section from the class
            Section section = cl.getAnnotation(Section.class);

            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 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 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);

                if (ObjectHelper.isNotEmpty(record.quote())) {
                    quote = record.quote();
                    LOG.debug("Quoting columns with: {}", quote);
                }

                quoting = record.quoting();
                LOG.debug("CSV will be quoted: {}", quoting);

                autospanLine = record.autospanLine();
                LOG.debug("Autospan line in last record: {}", autospanLine);
            }

            if (section != null) {
                // BigIntegerFormatFactory 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());
            }
        }
    }
}