├── .gitignore
├── LICENSE.txt
├── NOTICE.txt
├── README.md
├── build.gradle
├── changelog.txt
├── docs
└── reference
│ ├── index.html
│ └── style.css
├── site
├── 2011
│ └── 01
│ │ └── .htaccess
├── favicon.ico
├── images
│ └── logo.png
├── index.html
└── style.css
├── src
└── org
│ └── beanio
│ ├── BeanIOConfigurationException.java
│ ├── BeanIOException.java
│ ├── BeanReader.java
│ ├── BeanReaderErrorHandler.java
│ ├── BeanReaderErrorHandlerSupport.java
│ ├── BeanReaderException.java
│ ├── BeanReaderIOException.java
│ ├── BeanWriter.java
│ ├── BeanWriterException.java
│ ├── BeanWriterIOException.java
│ ├── InvalidBeanException.java
│ ├── InvalidRecordException.java
│ ├── InvalidRecordGroupException.java
│ ├── MalformedRecordException.java
│ ├── Marshaller.java
│ ├── RecordContext.java
│ ├── StreamFactory.java
│ ├── UnexpectedRecordException.java
│ ├── UnidentifiedRecordException.java
│ ├── Unmarshaller.java
│ ├── annotation
│ ├── AnnotationConstants.java
│ ├── Field.java
│ ├── Fields.java
│ ├── Group.java
│ ├── Record.java
│ ├── Segment.java
│ └── package.html
│ ├── builder
│ ├── Align.java
│ ├── CsvParserBuilder.java
│ ├── DelimitedParserBuilder.java
│ ├── FieldBuilder.java
│ ├── FixedLengthParserBuilder.java
│ ├── GroupBuilder.java
│ ├── GroupBuilderSupport.java
│ ├── ParserBuilder.java
│ ├── PropertyBuilderSupport.java
│ ├── RecordBuilder.java
│ ├── SegmentBuilder.java
│ ├── SegmentBuilderSupport.java
│ ├── StreamBuilder.java
│ ├── XmlParserBuilder.java
│ ├── XmlType.java
│ └── package.html
│ ├── internal
│ ├── DefaultStreamFactory.java
│ ├── compiler
│ │ ├── ParserFactory.java
│ │ ├── ParserFactorySupport.java
│ │ ├── Preprocessor.java
│ │ ├── ProcessorSupport.java
│ │ ├── PropertyAccessorFactory.java
│ │ ├── StreamCompiler.java
│ │ ├── accessor
│ │ │ └── ReflectionAccessorFactory.java
│ │ ├── csv
│ │ │ ├── CsvParserFactory.java
│ │ │ └── package.html
│ │ ├── delimited
│ │ │ ├── DelimitedParserFactory.java
│ │ │ └── package.html
│ │ ├── fixedlength
│ │ │ ├── FixedLengthParserFactory.java
│ │ │ ├── FixedLengthPreprocessor.java
│ │ │ └── package.html
│ │ ├── flat
│ │ │ ├── FlatParserFactory.java
│ │ │ ├── FlatPreprocessor.java
│ │ │ └── package.html
│ │ ├── json
│ │ │ ├── JsonParserFactory.java
│ │ │ ├── JsonPreprocessor.java
│ │ │ └── package.html
│ │ ├── package.html
│ │ └── xml
│ │ │ ├── XmlParserFactory.java
│ │ │ ├── XmlPreprocessor.java
│ │ │ └── package.html
│ ├── config
│ │ ├── BeanConfig.java
│ │ ├── BeanIOConfig.java
│ │ ├── ComponentConfig.java
│ │ ├── ConfigurationLoader.java
│ │ ├── ConstantConfig.java
│ │ ├── FieldConfig.java
│ │ ├── GroupConfig.java
│ │ ├── PropertyConfig.java
│ │ ├── RecordConfig.java
│ │ ├── SegmentConfig.java
│ │ ├── SelectorConfig.java
│ │ ├── SimplePropertyConfig.java
│ │ ├── StreamConfig.java
│ │ ├── TypeHandlerConfig.java
│ │ ├── XmlTypeConstants.java
│ │ ├── annotation
│ │ │ ├── AnnotationParser.java
│ │ │ └── package.html
│ │ ├── beanio.properties
│ │ ├── package.html
│ │ └── xml
│ │ │ ├── XmlConfigurationLoader.java
│ │ │ ├── XmlMapping.java
│ │ │ ├── XmlMappingParser.java
│ │ │ ├── XmlMappingReader.java
│ │ │ └── package.html
│ ├── package.html
│ ├── parser
│ │ ├── AbortRecordUnmarshalligException.java
│ │ ├── Aggregation.java
│ │ ├── ArrayParser.java
│ │ ├── Bean.java
│ │ ├── BeanReaderImpl.java
│ │ ├── BeanWriterImpl.java
│ │ ├── CollectionBean.java
│ │ ├── CollectionParser.java
│ │ ├── Component.java
│ │ ├── Constant.java
│ │ ├── DelegatingParser.java
│ │ ├── ErrorContext.java
│ │ ├── Field.java
│ │ ├── FieldFormat.java
│ │ ├── Group.java
│ │ ├── Iteration.java
│ │ ├── MapParser.java
│ │ ├── MarshallerImpl.java
│ │ ├── MarshallingContext.java
│ │ ├── MessageFactory.java
│ │ ├── ObjectUtils.java
│ │ ├── Parser.java
│ │ ├── ParserComponent.java
│ │ ├── ParserLocal.java
│ │ ├── ParsingContext.java
│ │ ├── Property.java
│ │ ├── PropertyAccessor.java
│ │ ├── PropertyComponent.java
│ │ ├── Record.java
│ │ ├── RecordAggregation.java
│ │ ├── RecordArray.java
│ │ ├── RecordCollection.java
│ │ ├── RecordFormat.java
│ │ ├── RecordMap.java
│ │ ├── Segment.java
│ │ ├── Selector.java
│ │ ├── Stream.java
│ │ ├── StreamFormat.java
│ │ ├── StreamFormatSupport.java
│ │ ├── UnmarshallerImpl.java
│ │ ├── UnmarshallingContext.java
│ │ ├── Value.java
│ │ ├── accessor
│ │ │ ├── FieldReflectionAccessor.java
│ │ │ ├── MapAccessor.java
│ │ │ ├── MethodReflectionAccessor.java
│ │ │ ├── PropertyAccessorSupport.java
│ │ │ └── package.html
│ │ ├── format
│ │ │ ├── FieldPadding.java
│ │ │ ├── csv
│ │ │ │ ├── CsvStreamFormat.java
│ │ │ │ └── package.html
│ │ │ ├── delimited
│ │ │ │ ├── DelimitedFieldFormat.java
│ │ │ │ ├── DelimitedMarshallingContext.java
│ │ │ │ ├── DelimitedRecordFormat.java
│ │ │ │ ├── DelimitedStreamFormat.java
│ │ │ │ ├── DelimitedUnmarshallingContext.java
│ │ │ │ ├── defaultMessages.properties
│ │ │ │ └── package.html
│ │ │ ├── fixedlength
│ │ │ │ ├── FixedLengthFieldFormat.java
│ │ │ │ ├── FixedLengthFieldPadding.java
│ │ │ │ ├── FixedLengthMarshallingContext.java
│ │ │ │ ├── FixedLengthRecordFormat.java
│ │ │ │ ├── FixedLengthStreamFormat.java
│ │ │ │ ├── FixedLengthUnmarshallingContext.java
│ │ │ │ ├── defaultMessages.properties
│ │ │ │ └── package.html
│ │ │ ├── flat
│ │ │ │ ├── FlatFieldFormat.java
│ │ │ │ ├── FlatFieldFormatSupport.java
│ │ │ │ └── package.html
│ │ │ ├── json
│ │ │ │ ├── JsonFieldFormat.java
│ │ │ │ ├── JsonMarshallingContext.java
│ │ │ │ ├── JsonNode.java
│ │ │ │ ├── JsonNodeUtil.java
│ │ │ │ ├── JsonStreamFormat.java
│ │ │ │ ├── JsonUnmarshallingContext.java
│ │ │ │ ├── JsonWrapper.java
│ │ │ │ ├── defaultMessages.properties
│ │ │ │ └── package.html
│ │ │ ├── package.html
│ │ │ └── xml
│ │ │ │ ├── XmlAttributeField.java
│ │ │ │ ├── XmlElementField.java
│ │ │ │ ├── XmlFieldFormat.java
│ │ │ │ ├── XmlMarshallingContext.java
│ │ │ │ ├── XmlNode.java
│ │ │ │ ├── XmlNodeUtil.java
│ │ │ │ ├── XmlSelectorWrapper.java
│ │ │ │ ├── XmlStreamFormat.java
│ │ │ │ ├── XmlTextField.java
│ │ │ │ ├── XmlUnmarshallingContext.java
│ │ │ │ ├── XmlWrapper.java
│ │ │ │ ├── defaultMessages.properties
│ │ │ │ └── package.html
│ │ ├── message
│ │ │ ├── ResourceBundleMessageFactory.java
│ │ │ └── package.html
│ │ └── package.html
│ └── util
│ │ ├── BeanUtil.java
│ │ ├── DebugUtil.java
│ │ ├── Debuggable.java
│ │ ├── DomUtil.java
│ │ ├── EnumTypeHandler.java
│ │ ├── IOUtil.java
│ │ ├── JsonUtil.java
│ │ ├── LocaleUtil.java
│ │ ├── RecordFilterReader.java
│ │ ├── Replicateable.java
│ │ ├── Replicator.java
│ │ ├── ReplicatorTest.java
│ │ ├── Settings.java
│ │ ├── StatefulWriter.java
│ │ ├── StringUtil.java
│ │ ├── ToStringEnumTypeHandler.java
│ │ ├── TreeNode.java
│ │ ├── TypeHandlerFactory.java
│ │ ├── TypeUtil.java
│ │ └── package.html
│ ├── package.html
│ ├── stream
│ ├── RecordIOException.java
│ ├── RecordMarshaller.java
│ ├── RecordParserFactory.java
│ ├── RecordParserFactorySupport.java
│ ├── RecordReader.java
│ ├── RecordUnmarshaller.java
│ ├── RecordWriter.java
│ ├── csv
│ │ ├── CsvParserConfiguration.java
│ │ ├── CsvReader.java
│ │ ├── CsvRecordParser.java
│ │ ├── CsvRecordParserFactory.java
│ │ ├── CsvWriter.java
│ │ └── package.html
│ ├── delimited
│ │ ├── DelimitedParserConfiguration.java
│ │ ├── DelimitedReader.java
│ │ ├── DelimitedRecordParser.java
│ │ ├── DelimitedRecordParserFactory.java
│ │ ├── DelimitedWriter.java
│ │ └── package.html
│ ├── fixedlength
│ │ ├── FixedLengthParserConfiguration.java
│ │ ├── FixedLengthReader.java
│ │ ├── FixedLengthRecordParser.java
│ │ ├── FixedLengthRecordParserFactory.java
│ │ ├── FixedLengthWriter.java
│ │ └── package.html
│ ├── json
│ │ ├── JsonParserConfiguration.java
│ │ ├── JsonReader.java
│ │ ├── JsonReaderSupport.java
│ │ ├── JsonRecordMarshaller.java
│ │ ├── JsonRecordParserFactory.java
│ │ ├── JsonRecordUnmarshaller.java
│ │ ├── JsonWriter.java
│ │ ├── JsonWriterSupport.java
│ │ └── package.html
│ ├── package.html
│ ├── util
│ │ ├── CommentReader.java
│ │ └── package.html
│ └── xml
│ │ ├── ElementStack.java
│ │ ├── XmlParserConfiguration.java
│ │ ├── XmlReader.java
│ │ ├── XmlRecordMarshaller.java
│ │ ├── XmlRecordParserFactory.java
│ │ ├── XmlRecordUnmarshaller.java
│ │ ├── XmlStreamConfiguration.java
│ │ ├── XmlStreamConfigurationAware.java
│ │ ├── XmlWriter.java
│ │ └── package.html
│ ├── types
│ ├── BigDecimalTypeHandler.java
│ ├── BigIntegerTypeHandler.java
│ ├── BooleanTypeHandler.java
│ ├── ByteTypeHandler.java
│ ├── CalendarTypeHandler.java
│ ├── CharacterTypeHandler.java
│ ├── ConfigurableTypeHandler.java
│ ├── DateTypeHandler.java
│ ├── DateTypeHandlerSupport.java
│ ├── DoubleTypeHandler.java
│ ├── FloatTypeHandler.java
│ ├── IntegerTypeHandler.java
│ ├── LocaleSupport.java
│ ├── LongTypeHandler.java
│ ├── NumberTypeHandler.java
│ ├── ShortTypeHandler.java
│ ├── StringTypeHandler.java
│ ├── TypeConversionException.java
│ ├── TypeHandler.java
│ ├── URLTypeHandler.java
│ ├── UUIDTypeHandler.java
│ ├── package.html
│ └── xml
│ │ ├── AbstractXmlCalendarTypeHandler.java
│ │ ├── AbstractXmlDateTypeHandler.java
│ │ ├── XmlBooleanTypeHandler.java
│ │ ├── XmlCalendarDateTimeTypeHandler.java
│ │ ├── XmlCalendarDateTypeHandler.java
│ │ ├── XmlCalendarTimeTypeHandler.java
│ │ ├── XmlDateTimeTypeHandler.java
│ │ ├── XmlDateTypeHandler.java
│ │ ├── XmlTimeTypeHandler.java
│ │ └── package.html
│ └── xsd
│ ├── 2011
│ └── 01
│ │ └── mapping.xsd
│ └── 2012
│ └── 03
│ └── mapping.xsd
└── test
└── org
└── beanio
├── StreamFactoryTest.java
├── beans
├── Bean.groovy
├── Order.java
├── OrderBatch.java
├── OrderItem.java
└── Person.java
├── builder
└── BuilderTest.groovy
├── config
├── ConcreteBean.java
├── InterfaceBean.java
├── XmlMappingConfigurationTest.java
├── a.xml
├── ab.xml
├── ab_template.xml
├── b.xml
├── collectionAttributeField.xml
├── fieldNamespaceForText.xml
├── import.xml
├── imported.xml
├── invalidBeanClass.xml
├── invalidBeanXmlType.xml
├── invalidFieldXmlType.xml
├── invalidImport_InvalidResource.xml
├── invalidImport_ResourceNotFound.xml
├── invalidSetter.xml
├── invalidStreamMode.xml
├── invalidStreamXmlType.xml
├── nillableAttributeField.xml
├── noBeanProperty.xml
├── noReadableMethod.xml
├── noWriteableMethod.xml
└── prefixWithNoNamespace.xml
├── file.txt
├── mapping.xml
├── parser
├── AbstractParserTest.groovy
├── ParserTest.java
├── annotation
│ ├── AnnotatedBulb.java
│ ├── AnnotatedFloor.java
│ ├── AnnotatedGroupTest.groovy
│ ├── AnnotatedLight.java
│ ├── AnnotatedRoom.java
│ ├── AnnotatedUser.java
│ ├── AnnotatedUserInterface.java
│ ├── AnnotatedUserSupport.java
│ └── AnnotationTest.java
├── bean
│ ├── BeanParserTest.java
│ ├── Widget.java
│ ├── w10_nestedBeans.txt
│ ├── w1_position.txt
│ ├── w2_collections.txt
│ ├── w3_fixedLength.txt
│ ├── w4_map.txt
│ ├── w5_outOfOrder.txt
│ ├── w6_fieldError.txt
│ ├── w9_flcollections.txt
│ └── widget.xml
├── collection
│ ├── CollectionBean.java
│ ├── CollectionFieldParserTest.java
│ ├── collection.xml
│ ├── dc1_valid.txt
│ ├── dc2_nullPrimitive.txt
│ └── fc1_valid.txt
├── comments
│ ├── CommentsParserTest.java
│ ├── c1.txt
│ └── comments_mapping.xml
├── constructor
├── defaultValue
│ └── DefaultValueTest.groovy
├── delimited
│ ├── DelimitedParserTest.java
│ ├── d1_messages.properties
│ ├── d1_recordErrors.txt
│ ├── d2_optionalField.txt
│ ├── d3_padding.txt
│ └── delimited.xml
├── direct
│ ├── DirectParserTest.java
│ ├── DirectUser.java
│ ├── d1.txt
│ └── direct_mapping.xml
├── dynamicOccurs
│ ├── DynamicOccursParserTest.java
│ └── dynamicOccurs_mapping.xml
├── fixedlength
│ ├── FixedLengthParserTest.java
│ ├── f1_maxLength.txt
│ ├── f1_minLength.txt
│ ├── f1_valid.txt
│ ├── f2_invalid.txt
│ ├── f2_messages.properties
│ ├── f2_valid.txt
│ ├── f3_valid.txt
│ ├── f4_padding.txt
│ ├── f5_valid.txt
│ ├── f7.txt
│ └── fixedlength.xml
├── groups
│ ├── GroupParserTest.java
│ ├── g1_empty.txt
│ ├── g1_missingBatchTrailer.txt
│ ├── g1_noHeader.txt
│ ├── g1_noTrailer.txt
│ ├── g1_nobatch.txt
│ ├── g1_oneBatch.txt
│ ├── g1_threeBatch.txt
│ ├── g1_tooManyHeaders.txt
│ ├── g1_unidentifiedRecord.txt
│ ├── g2_empty.txt
│ ├── g2_missingGroup.txt
│ ├── g2_tooManyGroups.txt
│ ├── g2_twoLayout.txt
│ ├── g2_valid1.txt
│ ├── g3_valid.txt
│ ├── g4_endOfGroup.txt
│ ├── g4_repeatingGroup.txt
│ ├── g4_tooManyGroups.txt
│ ├── g5_subgroups.txt
│ ├── g6_missingRecordEOF.txt
│ ├── g7_missingGroupEOF.txt
│ ├── g8_repeatingStream.txt
│ └── group.xml
├── ignoreUnidentifiedRecords
│ ├── IgnoreUnidentifiedRecordsParserTest.java
│ ├── ignoreUnidentifiedRecords1.txt
│ └── ignore_mapping.xml
├── imports
│ ├── ImportParserTest.java
│ ├── circular_mapping1.xml
│ ├── circular_mapping2.xml
│ ├── circular_mapping3.xml
│ ├── import_mapping1.xml
│ ├── import_mapping2.xml
│ └── import_mapping3.xml
├── indeterminates
│ ├── IndeterminateSegmentsTest.java
│ └── indeterminates_mapping.xml
├── inlinemaps
│ ├── InlineMapParserTest.java
│ ├── InlineMapsTest.groovy
│ ├── Job.java
│ └── map_mapping.xml
├── json
│ ├── JsonTestRecordParserFactory.java
│ ├── field
│ │ ├── JsonFieldParserTest.java
│ │ ├── jf1.txt
│ │ └── jsonField_mapping.xml
│ └── segment
│ │ ├── JsonSegmentParserTest.java
│ │ ├── js1.txt
│ │ ├── js2.txt
│ │ ├── js3.txt
│ │ ├── js4.txt
│ │ ├── jsonSegment_mapping.xml
│ │ └── notes.txt
├── lazy
│ ├── Account.java
│ ├── LazyMapTest.groovy
│ ├── LazyTest.java
│ ├── LazyUser.java
│ ├── Transaction.java
│ └── lazy_mapping.xml
├── lenientPadding
│ └── LenientPaddingTest.groovy
├── misc
│ ├── MiscParserTest.java
│ ├── m1.txt
│ └── misc_mapping.xml
├── multiline
│ ├── MultilineRecordTest.java
│ ├── ml1.txt
│ ├── ml2.txt
│ ├── ml3.txt
│ ├── ml4.txt
│ ├── ml5.txt
│ ├── ml6.txt
│ ├── ml7.txt
│ └── multiline_mapping.xml
├── ordinal
│ └── OrdinalTest.groovy
├── property
│ ├── PropertyParserTest.java
│ ├── User.java
│ ├── p1.txt
│ └── property_mapping.xml
├── ridlength
│ ├── RidLengthTest.java
│ ├── r1.txt
│ └── ridlength_mapping.xml
├── skip
│ ├── SkippingParserTest.java
│ ├── s1.txt
│ └── skip_mapping.xml
├── strict
│ ├── StrictTest.java
│ ├── s1_invalidRecordLength.txt
│ ├── s1_invalidSequence.txt
│ └── strict_mapping.xml
├── substitution
│ ├── PropertySubstitutionParserTest.java
│ └── substitution_mapping.xml
├── target
│ ├── TargetTest.java
│ ├── targetAndClass.xml
│ ├── targetIsNotProperty.xml
│ ├── targetNotFound.xml
│ ├── targetRepeating.xml
│ └── target_mapping.xml
├── template
│ ├── TemplateParserTest.java
│ ├── t1.txt
│ ├── t3.txt
│ └── template_mapping.xml
├── trim
│ ├── TrimTest.java
│ └── trim_mapping.xml
├── types
│ ├── ObjectRecord.java
│ ├── PrimitiveRecord.java
│ ├── TypeEnum.java
│ ├── TypeHandlerLocaleTest.groovy
│ ├── TypesParserTest.java
│ ├── t1_valid.txt
│ ├── t2_valid.txt
│ ├── t3_valid.txt
│ ├── t4_valid.txt
│ ├── t5_valid.txt
│ ├── t7_valid.txt
│ ├── t8_valid.txt
│ └── types.xml
├── validation
│ ├── FieldValidationTest.java
│ ├── MarshalledFieldValidationTest.groovy
│ ├── v1.txt
│ ├── v1_messages.properties
│ └── validation.xml
├── writemode
│ ├── PersonInterface.java
│ ├── WriteModeParserTest.java
│ └── writemode_mapping.xml
└── xml
│ ├── Address.java
│ ├── Male.java
│ ├── Person.java
│ ├── TestXmlWriterFactory.java
│ ├── XmlParserTest.java
│ ├── bean
│ ├── XmlBeansTest.java
│ ├── b1_in.xml
│ ├── b1_out.xml
│ ├── b2_in.xml
│ ├── b2_out.xml
│ ├── b3_in.xml
│ ├── b4_in.xml
│ ├── b5_in.xml
│ ├── b5_out.xml
│ └── beans_mapping.xml
│ ├── collection
│ ├── XmlCollectionTest.java
│ ├── c1_in.xml
│ └── collection_mapping.xml
│ ├── field
│ ├── XmlFieldTest.java
│ ├── f1_in.xml
│ ├── f2_in.xml
│ ├── f2_out.xml
│ ├── f3_in.xml
│ └── field_mapping.xml
│ ├── groups
│ ├── XmlGroupsTest.java
│ ├── g1_in.xml
│ ├── g2_in.xml
│ ├── g3_in.xml
│ └── groups_mapping.xml
│ ├── marshaller
│ ├── XmlMarshallerTest.java
│ └── marshaller_mapping.xml
│ ├── multiline
│ ├── XmlMultilineRecordTest.java
│ ├── ml1_in.xml
│ ├── ml1_out.xml
│ └── xml_multiline_mapping.xml
│ ├── namespace
│ ├── XmlNamespaceTest.java
│ ├── namespace_mapping.xml
│ ├── ns10_out.xml
│ ├── ns11_out.xml
│ ├── ns12_out.xml
│ ├── ns13_out.xml
│ ├── ns1_in.xml
│ ├── ns1_out.xml
│ ├── ns2_out.xml
│ ├── ns3_out.xml
│ ├── ns4_out.xml
│ ├── ns5_out.xml
│ ├── ns6_out.xml
│ ├── ns7_out.xml
│ ├── ns8_out.xml
│ ├── ns9_out.xml
│ ├── ns_noMatchingField.xml
│ ├── ns_noMatchingGroup.xml
│ ├── ns_noMatchingRecord.xml
│ └── ns_noMatchingStream.xml
│ ├── record
│ ├── XmlRecordTest.java
│ ├── r1_in.xml
│ └── record_mapping.xml
│ ├── typehandler
│ ├── XmlTypeHandlerTest.java
│ ├── th1_in.xml
│ └── typehandler_mapping.xml
│ ├── types
│ ├── NillableStringTypeHandler.java
│ ├── XmlTypesTest.java
│ ├── t1_in.xml
│ ├── t1_out.xml
│ ├── t2_in.xml
│ ├── t2_out.xml
│ ├── t3_in.xml
│ ├── t3_out.xml
│ ├── t5_in.xml
│ ├── t6_in.xml
│ ├── t7_out.xml
│ └── types_mapping.xml
│ ├── validation
│ ├── XmlValidationTest.java
│ ├── v1_in.xml
│ ├── v2_in.xml
│ └── validation_mapping.xml
│ └── wrapper
│ ├── XmlWrapperTest.java
│ ├── w1_in.xml
│ ├── w2_in.xml
│ ├── w3_in.xml
│ └── wrapper_mapping.xml
├── stream
├── CsvReaderTest.java
├── CsvRecordParserTest.java
├── CsvWriterTest.java
├── DelimitedReaderTest.java
├── DelimitedRecordParserTest.java
├── DelimitedWriterTest.java
├── FixedLengthReaderTest.java
├── FixedLengthWriterTest.java
├── JsonReaderTest.java
├── JsonWriterTest.java
└── StrictStringReader.java
├── types
├── CalendarTypeHandlerTest.groovy
├── CharacterTypeHandlerTest.java
├── DateTypeHandlerTest.java
├── NumberTypeHandlerTest.java
├── StringTypeHandlerTest.java
├── TypeHandlerFactoryTest.java
├── XmlBooleanTypeHandlerTest.java
├── XmlCalendarDateTimeTypeHandlerTest.java
├── XmlCalendarDateTypeHandlerTest.java
├── XmlCalendarTimeTypeHandlerTest.java
├── XmlDateTimeTypeHandlerTest.java
├── XmlDateTypeHandlerTest.java
└── XmlTimeTypeHandlerTest.java
└── util
├── IOUtilTest.java
├── StringUtilTest.java
└── TypeUtilTest.java
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 | .classpath
3 | .settings
4 | .project
5 | .gradle
6 |
7 | # Mobile Tools for Java (J2ME)
8 | .mtj.tmp/
9 |
10 | # Package Files #
11 | *.jar
12 | *.war
13 | *.ear
14 |
15 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
16 | hs_err_pid*
17 | /build/
18 | /classes/
19 |
--------------------------------------------------------------------------------
/NOTICE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2010-2014 Kevin Seim
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | BeanIO
2 | ======
3 |
4 | A Java library for marshalling and unmarshalling bean objects from XML, CSV, delimited and fixed length stream formats.
5 |
6 | For more information, including an online reference guide, please visit http://www.beanio.org.
7 |
8 | #### Note
9 | This repository houses the source code for the future BeanIO 3.x. For older versions, please see https://code.google.com/p/beanio/.
10 |
11 |
--------------------------------------------------------------------------------
/docs/reference/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | width: 900px;
3 | margin: 0 auto 0 auto;
4 | font-family: verdana, arial, sans-serif;
5 | font-size: 85%;
6 | }
7 |
8 | .wrapping li { margin-top: 6px }
9 | tt { font-size: 10pt; }
10 | pre { font-size: 9pt; }
11 | .toc { margin-left: 3%; }
12 | .indent { margin-left: 5%;}
13 | .red { color: red; }
14 |
15 | .title {
16 | font-size: 180%;
17 | font-weight: bold;
18 | margin-top: 20px;
19 | }
20 |
21 | h1 {
22 | font-size: 155%;
23 | margin-top: 1em;
24 | }
25 | h2 {
26 | font-size: 130%;
27 | font-weight: bold;
28 | }
29 | h3 {
30 | font-size: 115%;
31 | font-style: italic;
32 | }
33 | h4 {
34 | margin-bottom: 0;
35 | }
36 |
37 | .file {
38 | background: #F5F5F5;
39 | border: 1px solid black;
40 | margin-left: 5%;
41 | margin-right: 5%;
42 | padding: 3px 8px 3px 8px;
43 | }
44 |
45 | .java {
46 | background: #F5F5F5;
47 | border: 1px solid black;
48 | margin-left: 5%;
49 | margin-right: 5%;
50 | padding: 3px 8px 3px 8px;
51 | }
52 | .comment {
53 | color: green;
54 | }
55 |
56 | pre b, .highlight {
57 | color: #000088;
58 | font-weight: bold;
59 | }
60 |
61 | .typeTable {
62 | margin-left: 5%;
63 | }
64 |
65 | table { border-collapse: collapse; }
66 |
67 | td, th {
68 | vertical-align: top;
69 | padding-right: 20px;
70 | padding-left: 5px;
71 | border: 1px solid gray;
72 | }
73 |
--------------------------------------------------------------------------------
/site/2011/01/.htaccess:
--------------------------------------------------------------------------------
1 | DirectoryIndex mapping.xsd
--------------------------------------------------------------------------------
/site/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinseim/beanio/c31768943b963a8c48ed13f66498e331fdb0f2bc/site/favicon.ico
--------------------------------------------------------------------------------
/site/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinseim/beanio/c31768943b963a8c48ed13f66498e331fdb0f2bc/site/images/logo.png
--------------------------------------------------------------------------------
/src/org/beanio/BeanIOException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2011 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio;
17 |
18 | /**
19 | * Base class for all exceptions thrown by the BeanIO framework.
20 | *
21 | * @author Kevin Seim
22 | * @since 1.0
23 | */
24 | public class BeanIOException extends RuntimeException {
25 |
26 | private static final long serialVersionUID = 1L;
27 |
28 | /**
29 | * Constructs a new BeanIOException.
30 | * @param message the error message
31 | * @param cause the root cause
32 | */
33 | public BeanIOException(String message, Throwable cause) {
34 | super(message, cause);
35 | }
36 |
37 | /**
38 | * Constructs a new BeanIOException.
39 | * @param message the error message
40 | */
41 | public BeanIOException(String message) {
42 | super(message);
43 | }
44 |
45 | /**
46 | * Constructs a new BeanIOException.
47 | * @param cause the root cause
48 | */
49 | public BeanIOException(Throwable cause) {
50 | super(cause);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/org/beanio/BeanReaderErrorHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio;
17 |
18 | /**
19 | * A callback interface for handling exceptions thrown by a {@link BeanReader}. When set on a BeanReader,
20 | * the BeanReader will delegate all exception handling to this class. When an error handler
21 | * is not set on a reader, the BeanReader's read() will simply throw the exception.
22 | *
23 | * @author Kevin Seim
24 | * @since 1.0
25 | * @see BeanReader
26 | */
27 | public interface BeanReaderErrorHandler {
28 |
29 | /**
30 | * Callback method for handling a {@link BeanReaderException} when using
31 | * a {@link BeanReader}.
32 | * @param ex the {@link BeanReaderException} to handle
33 | * @throws Exception if the BeanReaderException is rethrown or the error
34 | * handler throws a new Exception
35 | */
36 | public void handleError(BeanReaderException ex) throws Exception;
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/org/beanio/BeanReaderIOException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio;
17 |
18 | import java.io.IOException;
19 |
20 | /**
21 | * Exception thrown when a {@link BeanReader}'s underlying
22 | * input stream throws an {@link IOException}.
23 | *
24 | * @author Kevin Seim
25 | * @since 1.0
26 | */
27 | public class BeanReaderIOException extends BeanReaderException {
28 |
29 | private static final long serialVersionUID = 2L;
30 |
31 | /**
32 | * Constructs a new BeanReaderIOException.
33 | * @param message the error message
34 | */
35 | public BeanReaderIOException(String message) {
36 | this(message, null);
37 | }
38 |
39 | /**
40 | * Constructs a new BeanReaderIOException.
41 | * @param message the error message
42 | * @param cause the root cause
43 | */
44 | public BeanReaderIOException(String message, IOException cause) {
45 | super(message, cause);
46 | }
47 |
48 | @Override
49 | public IOException getCause() {
50 | return (IOException) super.getCause();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/org/beanio/InvalidBeanException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio;
17 |
18 | /**
19 | * Exception thrown by a {@link BeanWriter} or {@link Marshaller}, when a bean
20 | * cannot be marshalled to meet the configured field validation rules.
21 | * @author Kevin Seim
22 | */
23 | public class InvalidBeanException extends BeanWriterException {
24 |
25 | private static final long serialVersionUID = 1L;
26 |
27 | /**
28 | * Constructs a new InvalidBeanException.
29 | * @param message the error message
30 | */
31 | public InvalidBeanException(String message) {
32 | super(message);
33 | }
34 |
35 | /**
36 | * Constructs a new InvalidBeanException.
37 | * @param message the error message
38 | * @param cause the root cause
39 | */
40 | public InvalidBeanException(String message, Throwable cause) {
41 | super(message, cause);
42 | }
43 |
44 | /**
45 | * Constructs a new InvalidBeanException.
46 | * @param cause the root cause
47 | */
48 | public InvalidBeanException(Throwable cause) {
49 | super(cause);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/org/beanio/UnexpectedRecordException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio;
17 |
18 | /**
19 | * Exception thrown when the record type of last record read by a {@link BeanReader}
20 | * is out of order based on the expected order defined by the stream's mapping file.
21 | * After this exception is thrown, further reads from the stream will likely result in
22 | * further exceptions.
23 | *
24 | * @author Kevin Seim
25 | * @since 1.0
26 | */
27 | public class UnexpectedRecordException extends BeanReaderException {
28 |
29 | private static final long serialVersionUID = 2L;
30 |
31 | /**
32 | * Constructs a new UnexpectedRecordException.
33 | * @param context the current context of the bean reader
34 | * @param message the error message
35 | */
36 | public UnexpectedRecordException(RecordContext context, String message) {
37 | super(message);
38 | setRecordContext(context);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/org/beanio/UnidentifiedRecordException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio;
17 |
18 | /**
19 | * Exception thrown when the record type of the last record read from a {@link BeanReader}
20 | * could not be determined. If the mapping file is used to enforce strict record ordering,
21 | * further reads from the stream will likely cause further exceptions.
22 | *
23 | * @author Kevin Seim
24 | * @since 1.0
25 | */
26 | public class UnidentifiedRecordException extends BeanReaderException {
27 |
28 | private static final long serialVersionUID = 2L;
29 |
30 | /**
31 | * Constructs a new UnidentifiedRecordException.
32 | * @param context the current context of the bean reader
33 | * @param message the error message
34 | */
35 | public UnidentifiedRecordException(RecordContext context, String message) {
36 | super(message);
37 | setRecordContext(context);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/org/beanio/annotation/AnnotationConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.annotation;
17 |
18 | /**
19 | * Constant annotation values.
20 | *
21 | * @author Kevin Seim
22 | * @since 2.1.0
23 | */
24 | public interface AnnotationConstants {
25 |
26 | /** The default value for undefined XML related annotation properties */
27 | public static final String UNDEFINED = "{undefined}";
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/org/beanio/annotation/Fields.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.annotation;
17 |
18 | import java.lang.annotation.*;
19 |
20 | /**
21 | * Annotation used to add fields to a record or segment that are not bound
22 | * to a class property.
23 | *
24 | * @author Kevin Seim
25 | * @since 2.1.0
26 | */
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
29 | public @interface Fields {
30 |
31 | /**
32 | * The list of fields.
33 | * @return the list of fields
34 | */
35 | Field[] value();
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/org/beanio/annotation/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Stream builder annotations.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/builder/Align.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.builder;
17 |
18 | /**
19 | * Enumeration of text alignments in a padded field.
20 | * @author Kevin Seim
21 | * @since 2.1.0
22 | */
23 | public enum Align {
24 |
25 | /** Text is aligned to the left */
26 | LEFT,
27 |
28 | /** Text is aligned to the right */
29 | RIGHT;
30 |
31 | @Override
32 | public String toString() {
33 | return name().toLowerCase();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/org/beanio/builder/ParserBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.builder;
17 |
18 | import org.beanio.internal.config.BeanConfig;
19 | import org.beanio.stream.RecordParserFactory;
20 |
21 | /**
22 | * @author Kevin Seim
23 | * @since 2.1.0
24 | */
25 | public abstract class ParserBuilder {
26 |
27 | ParserBuilder() { }
28 |
29 | public abstract BeanConfig build();
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/org/beanio/builder/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Stream builder API.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/compiler/PropertyAccessorFactory.java:
--------------------------------------------------------------------------------
1 | package org.beanio.internal.compiler;
2 |
3 | import java.beans.PropertyDescriptor;
4 | import java.lang.reflect.Field;
5 |
6 | import org.beanio.internal.parser.PropertyAccessor;
7 |
8 | /**
9 | * Factory interface for creating {@link PropertyAccessor}
10 | * implementations.
11 | *
12 | * @author Kevin Seim
13 | * @since 2.0.1
14 | */
15 | public interface PropertyAccessorFactory {
16 |
17 | /**
18 | * Creates a new {@link PropertyAccessor}.
19 | * @param parent the parent bean object type
20 | * @param descriptor the {@link PropertyDescriptor} to access
21 | * @param carg the constructor argument index
22 | * @return the new {@link PropertyAccessor}
23 | */
24 | public PropertyAccessor getPropertyAccessor(
25 | Class> parent, PropertyDescriptor descriptor, int carg);
26 |
27 | /**
28 | * Creates a new {@link PropertyAccessor}.
29 | * @param parent the parent bean object type
30 | * @param field the {@link Field} to access
31 | * @param carg the constructor argument index
32 | * @return the new {@link PropertyAccessor}
33 | */
34 | public PropertyAccessor getPropertyAccessor(
35 | Class> parent, Field field, int carg);
36 | }
37 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/compiler/accessor/ReflectionAccessorFactory.java:
--------------------------------------------------------------------------------
1 | package org.beanio.internal.compiler.accessor;
2 |
3 | import java.beans.PropertyDescriptor;
4 | import java.lang.reflect.Field;
5 |
6 | import org.beanio.internal.compiler.PropertyAccessorFactory;
7 | import org.beanio.internal.parser.PropertyAccessor;
8 | import org.beanio.internal.parser.accessor.*;
9 |
10 | /**
11 | * {@link PropertyAccessorFactory} implementations based on Java reflection.
12 | *
13 | * @author Kevin Seim
14 | * @since 2.0.1
15 | */
16 | public class ReflectionAccessorFactory implements PropertyAccessorFactory {
17 |
18 | /*
19 | * (non-Javadoc)
20 | * @see org.beanio.internal.compiler.PropertyAccessorFactory#getPropertyAccessor(java.lang.Class, java.beans.PropertyDescriptor, int)
21 | */
22 | public PropertyAccessor getPropertyAccessor(
23 | Class> parent, PropertyDescriptor descriptor, int carg) {
24 |
25 | MethodReflectionAccessor a = new MethodReflectionAccessor(descriptor, carg);
26 | a.setConstructorArgumentIndex(carg);
27 | return a;
28 | }
29 |
30 | /*
31 | * (non-Javadoc)
32 | * @see org.beanio.internal.compiler.PropertyAccessorFactory#getPropertyAccessor(java.lang.Class, java.lang.reflect.Field, int)
33 | */
34 | public PropertyAccessor getPropertyAccessor(
35 | Class> parent, Field field, int carg) {
36 |
37 | FieldReflectionAccessor a = new FieldReflectionAccessor(field, carg);
38 | a.setConstructorArgumentIndex(carg);
39 | return a;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/compiler/csv/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | ParserFactory implementation for the CSV stream format.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/compiler/delimited/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | ParserFactory implementation for the delimited stream format.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/compiler/fixedlength/FixedLengthPreprocessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.compiler.fixedlength;
17 |
18 | import org.beanio.internal.compiler.Preprocessor;
19 | import org.beanio.internal.compiler.flat.FlatPreprocessor;
20 | import org.beanio.internal.config.*;
21 |
22 | /**
23 | * Configuration {@link Preprocessor} for a fixed length stream format.
24 | *
25 | * @author Kevin Seim
26 | * @since 2.0
27 | */
28 | public class FixedLengthPreprocessor extends FlatPreprocessor {
29 |
30 | /**
31 | * Constructs a new FixedLengthPreprocessor.
32 | * @param stream the stream configuration to pre-process
33 | */
34 | public FixedLengthPreprocessor(StreamConfig stream) {
35 | super(stream);
36 | }
37 |
38 | @Override
39 | protected int getSize(FieldConfig field) {
40 | return field.getLength();
41 | }
42 |
43 | @Override
44 | protected boolean isFixedLength() {
45 | return true;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/compiler/fixedlength/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | ParserFactory implementation for the fixed length stream format.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/compiler/flat/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Base ParserFactory implementation for flat stream formats (CSV, delimited and fixed length).
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/compiler/json/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | ParserFactory implementation for the JSON stream format.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/compiler/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Classes to "compile" a stream configuration into a Stream parser.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/compiler/xml/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | ParserFactory implementation for the XML stream format.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/config/ConfigurationLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2011 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.config;
17 |
18 | import java.io.*;
19 | import java.util.*;
20 |
21 | import org.beanio.BeanIOConfigurationException;
22 |
23 | /**
24 | * A ConfigurationLoader is used to load BeanIO mapping configurations from
25 | * an input stream.
26 | *
27 | *
Implementations must be thread safe.
28 | *
29 | * @author Kevin Seim
30 | * @since 1.0
31 | */
32 | public interface ConfigurationLoader {
33 |
34 | /**
35 | * Loads a BeanIO configuration from an input stream.
36 | * @param in the input stream to read the configuration from
37 | * @param properties the {@link Properties} for expansion in the mapping file
38 | * @return a collection of loaded BeanIO configurations
39 | * @throws IOException if an I/O error occurs
40 | * @throws BeanIOConfigurationException if the configuration is invalid or malformed
41 | * @since 1.2.1
42 | */
43 | public Collection loadConfiguration(InputStream in, Properties properties)
44 | throws IOException, BeanIOConfigurationException;
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/config/XmlTypeConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.config;
17 |
18 | /**
19 | * XML node type constants.
20 | *
21 | * @author Kevin Seim
22 | * @since 1.1
23 | */
24 | public interface XmlTypeConstants {
25 |
26 | /** The XML node type to indicate the node is not a structural part of the document */
27 | public static final String XML_TYPE_NONE = "none";
28 | /** The XML node type for an element */
29 | public static final String XML_TYPE_ELEMENT = "element";
30 | /** The XML node type for an attribute */
31 | public static final String XML_TYPE_ATTRIBUTE = "attribute";
32 | /** The XML node type for elemental text */
33 | public static final String XML_TYPE_TEXT = "text";
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/config/annotation/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Annotation based mapping loader.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/config/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Mapping file configuration counterparts.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/config/xml/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | XML based mapping loader.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Internal BeanIO implementation classes. Class level API's are subject to change in any release
4 | without support for backwards compatibility.
5 |
6 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/AbortRecordUnmarshalligException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.parser;
17 |
18 | /**
19 | * This exception may be thrown by {@link Parser#unmarshal(UnmarshallingContext)} to
20 | * abort record unmarshalling after a critical validation error has occurred.
21 | * @author Kevin Seim
22 | * @since 2.1.0
23 | */
24 | @SuppressWarnings("serial")
25 | public class AbortRecordUnmarshalligException extends RuntimeException {
26 |
27 | /**
28 | * Constructs a new AbortRecordUnmarshalligException.
29 | */
30 | public AbortRecordUnmarshalligException() { }
31 |
32 | /**
33 | * Constructs a new AbortRecordUnmarshalligException.
34 | * @param message the error message (for debugging purposes only)
35 | */
36 | public AbortRecordUnmarshalligException(String message) {
37 | super(message);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/Iteration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2013 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.parser;
17 |
18 | /**
19 | * Repeating components must implement Iteration to offset record positions
20 | * during marshalling and unmarshalling.
21 | *
22 | * @author Kevin Seim
23 | * @since 2.0
24 | */
25 | public interface Iteration {
26 |
27 | /**
28 | * Returns the index of the current iteration relative to its parent.
29 | * @return the index of the current iteration
30 | */
31 | public int getIterationIndex(ParsingContext context);
32 |
33 | /**
34 | * Returns the size of the components that make up a single iteration.
35 | * @return the iteration size
36 | */
37 | public int getIterationSize();
38 |
39 | /**
40 | * Returns whether the iteration size is variable based on another field
41 | * in the record.
42 | * @return true if variable, false otherwise
43 | */
44 | public boolean isDynamicIteration();
45 | }
46 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/ObjectUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.parser;
17 |
18 | import org.beanio.BeanIOException;
19 |
20 | /**
21 | * Utility class for instantiating objects.
22 | * @author Kevin
23 | * @since 2.0.3
24 | */
25 | class ObjectUtils {
26 |
27 | public static T newInstance(Class type) {
28 | if (type == null) {
29 | return null;
30 | }
31 |
32 | try {
33 | return type.newInstance();
34 | }
35 | catch (Exception ex) {
36 | throw new BeanIOException("Failed to instantiate class '" + type.getName() + "'");
37 | }
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/ParserComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.parser;
17 |
18 | /**
19 | * Base class for all parser components in that implement {@link Parser}.
20 | *
21 | *
The method {@link #isSupportedChild(Component)} is overridden to restrict
22 | * children to components that also implement {@link Parser}.
23 | *
24 | * @author Kevin Seim
25 | * @since 2.0
26 | * @see Parser
27 | */
28 | public abstract class ParserComponent extends Component implements Parser {
29 |
30 | /**
31 | * Constructs a new ParserComponent.
32 | */
33 | public ParserComponent() {
34 | super();
35 | }
36 |
37 | /**
38 | * Constructs a new ParserComponent.
39 | * @param size the initial child capacity
40 | */
41 | public ParserComponent(int size) {
42 | super(size);
43 | }
44 |
45 | @Override
46 | protected boolean isSupportedChild(Component child) {
47 | return child instanceof Parser;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/RecordFormat.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.parser;
17 |
18 | /**
19 | * A RecordFormat provides format specific processing for a {@link Record} parser.
20 | *
21 | *
Implementations of this interface must be thread-safe.
22 | *
23 | * @author Kevin Seim
24 | * @since 2.0
25 | */
26 | public interface RecordFormat {
27 |
28 | /**
29 | * Returns whether the record meets configured matching criteria
30 | * during unmarshalling.
31 | * @param context the {@link UnmarshallingContext}
32 | * @return true if the record meets all matching criteria, false otherwise
33 | * @since 2.0.3
34 | */
35 | public boolean matches(UnmarshallingContext context);
36 |
37 | /**
38 | * Validates a record during unmarshalling.
39 | * @param context the {@link UnmarshallingContext} to validate
40 | */
41 | public void validate(UnmarshallingContext context);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/Value.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.parser;
17 |
18 | /**
19 | * Stores special property values.
20 | * @author Kevin Seim
21 | * @since 2.0
22 | */
23 | public interface Value {
24 |
25 | /** Constant indicating the field did not pass validation. */
26 | public static final String INVALID = new String("-invalid-");
27 |
28 | /** Constant indicating the field was not present in the stream */
29 | public static final String MISSING = new String("-missing-");
30 |
31 | /** Constant indicating the field was nil (XML only) */
32 | public static final String NIL = new String("-nil-");
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/accessor/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | PropertyAccessor implementation classes.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/format/csv/CsvStreamFormat.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.parser.format.csv;
17 |
18 | import org.beanio.internal.parser.StreamFormatSupport;
19 | import org.beanio.internal.parser.format.delimited.DelimitedStreamFormat;
20 |
21 | /**
22 | * A {@link StreamFormatSupport} implementation for the CSV format.
23 | *
24 | * @author Kevin Seim
25 | * @since 2.0
26 | */
27 | public class CsvStreamFormat extends DelimitedStreamFormat {
28 |
29 | /**
30 | * Constructs a new CsvStreamFormat.
31 | */
32 | public CsvStreamFormat() { }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/format/csv/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Parser implementation for the CSV stream format.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/format/delimited/DelimitedFieldFormat.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2013 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.parser.format.delimited;
17 |
18 | import org.beanio.internal.parser.*;
19 | import org.beanio.internal.parser.format.flat.FlatFieldFormatSupport;
20 |
21 | /**
22 | * A {@link FieldFormat} implementation for a field in a delimited stream.
23 | *
24 | * @author Kevin Seim
25 | * @since 2.0
26 | */
27 | public class DelimitedFieldFormat extends FlatFieldFormatSupport implements FieldFormat {
28 |
29 | /**
30 | * Constructs a new DelimitedFieldFormat.
31 | */
32 | public DelimitedFieldFormat() { }
33 |
34 | @Override
35 | public void insertFieldText(MarshallingContext context, String fieldText, boolean commit) {
36 | ((DelimitedMarshallingContext)context).setField(getPosition(), fieldText, commit);
37 | }
38 |
39 | @Override
40 | public String extractFieldText(UnmarshallingContext context, boolean reporting) {
41 | return ((DelimitedUnmarshallingContext)context).getFieldText(getName(), getPosition(), getUntil());
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/format/delimited/DelimitedStreamFormat.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.parser.format.delimited;
17 |
18 | import org.beanio.internal.parser.*;
19 |
20 | /**
21 | * A {@link StreamFormatSupport} implementation for the delimited stream format.
22 | *
23 | * @author Kevin Seim
24 | * @since 2.0
25 | */
26 | public class DelimitedStreamFormat extends StreamFormatSupport {
27 |
28 | /*
29 | * (non-Javadoc)
30 | * @see org.beanio.internal.parser.StreamFormat#createUnmarshallingContext()
31 | */
32 | public UnmarshallingContext createUnmarshallingContext() {
33 | return new DelimitedUnmarshallingContext();
34 | }
35 |
36 | /*
37 | * (non-Javadoc)
38 | * @see org.beanio.internal.parser.StreamFormat#createMarshallingContext()
39 | */
40 | public MarshallingContext createMarshallingContext(boolean streaming) {
41 | return new DelimitedMarshallingContext();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/format/delimited/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Parser implementation for the delimited stream format.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/format/fixedlength/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Parser implementation for the fixed length stream format.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/format/flat/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Base parser implementation for flat stream formats (CSV, delimited and fixed length).
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/format/json/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Parser implementation for the JSON stream format.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/format/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Format specific parser implementation classes.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/format/xml/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Parser implementation for the XML stream format.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/message/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | MessageFactory implementation classes.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/parser/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | BeanReader and BeanWriter implementation classes.
4 |
5 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/util/DebugUtil.java:
--------------------------------------------------------------------------------
1 | package org.beanio.internal.util;
2 |
3 | import java.io.*;
4 |
5 | import org.beanio.internal.parser.format.FieldPadding;
6 |
7 | /**
8 | * Utility methods for formatting debug output.
9 | * @author Kevin Seim
10 | * @since 2.1.0
11 | */
12 | public class DebugUtil {
13 |
14 | private DebugUtil() { }
15 |
16 | public static String formatRange(int min, int max) {
17 | if (max == Integer.MAX_VALUE) {
18 | return min + "+";
19 | }
20 | else {
21 | return min + "-" + max;
22 | }
23 | }
24 |
25 | public static String formatOption(String option, boolean value) {
26 | if (value) {
27 | return option;
28 | }
29 | else {
30 | return "!" + option;
31 | }
32 | }
33 |
34 | public static String formatPadding(FieldPadding padding) {
35 | if (padding == null) {
36 | return "";
37 | }
38 | else {
39 | return ", padded[" +
40 | "length=" + padding.getLength() +
41 | ", filler=" + padding.getFiller() +
42 | ", align=" + padding.getJustify() +
43 | "]";
44 | }
45 | }
46 |
47 | public static String toString(Debuggable c) {
48 | try {
49 | ByteArrayOutputStream out = new ByteArrayOutputStream();
50 | c.debug(new PrintStream(out));
51 | return new String(out.toByteArray(), "ASCII");
52 | }
53 | catch (UnsupportedEncodingException e) {
54 | throw new IllegalStateException(e);
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/util/Debuggable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2013 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.util;
17 |
18 | import java.io.PrintStream;
19 |
20 | /**
21 | * Interface implemented by marshallers and unmarshallers for debugging
22 | * BeanIO's compiled configuration. The information displayed by these
23 | * methods may be changed without notice.
24 | * @author Kevin Seim
25 | * @since 2.1.0
26 | */
27 | public interface Debuggable {
28 |
29 | /**
30 | * Prints the internal view of the stream configuration
31 | * to {@link System#out}
32 | */
33 | public void debug();
34 |
35 | /**
36 | * Prints the internal view of the stream configuration.
37 | * @param out the {@link PrintStream} to write to
38 | */
39 | public void debug(PrintStream out);
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/util/EnumTypeHandler.java:
--------------------------------------------------------------------------------
1 | package org.beanio.internal.util;
2 |
3 | import org.beanio.types.*;
4 |
5 | /**
6 | * Default {@link Enum} type handler that uses {@link Enum#valueOf(Class, String)}
7 | * to parse a value and {@link Enum#name()} to format a value.
8 | *
9 | * @author Kevin Seim
10 | * @since 2.0.1
11 | */
12 | @SuppressWarnings({"unchecked", "rawtypes"})
13 | public class EnumTypeHandler implements TypeHandler {
14 |
15 | private Class type;
16 |
17 | /**
18 | * Constructs a new EnumTypeHandler.
19 | * @param type the Enum class
20 | */
21 | public EnumTypeHandler(Class type) {
22 | this.type = type;
23 | }
24 |
25 | /*
26 | * (non-Javadoc)
27 | * @see org.beanio.types.TypeHandler#parse(java.lang.String)
28 | */
29 | public Object parse(String text) throws TypeConversionException {
30 | if (text == null || "".equals(text)) {
31 | return null;
32 | }
33 | try {
34 | return Enum.valueOf(type, text);
35 | }
36 | catch (IllegalArgumentException ex) {
37 | throw new TypeConversionException("Invalid " + getType().getSimpleName() +
38 | " enum value '" + text + "'", ex);
39 | }
40 | }
41 |
42 | /*
43 | * (non-Javadoc)
44 | * @see org.beanio.types.TypeHandler#format(java.lang.Object)
45 | */
46 | public String format(Object value) {
47 | if (value == null) {
48 | return null;
49 | }
50 | return ((Enum)value).name();
51 | }
52 |
53 | /*
54 | * (non-Javadoc)
55 | * @see org.beanio.types.TypeHandler#getType()
56 | */
57 | public Class> getType() {
58 | return type;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/org/beanio/internal/util/Replicateable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 Kevin Seim
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.beanio.internal.util;
17 |
18 | import java.util.Map;
19 |
20 | /**
21 | * Graph nodes that use a {@link Replicator} for cloning itself must implement
22 | * this interface.
23 | *
24 | * @author Kevin Seim
25 | * @since 2.0
26 | * @see Replicator
27 | */
28 | public interface Replicateable extends Cloneable {
29 |
30 | /**
31 | * Updates a node's references to other nodes.
32 | * @param map the (identity) map of clones by prior object reference
33 | */
34 | public void updateReferences(Map