Changes in version 1.0.1

Bugfixes

  • Added setter and getter for escape character in org.jsefa.csv.config.CsvConfiguration

New Features & changed behavior

  • None

Changes in version 1.0.0

Bugfixes

  • None

New Features & changed behavior

  • FLR: Introduced new setting 'crop=true|false' for FlrField annotation. Relevant for the serializing operation. If set to "true" an overlong field value will be cropped to the specified length (column width). This was the default behavior until JSefa version 0.9.4. Now, if set to "false", which is the default setting, a serialization exception is thrown in case of an overlong value length (default behavior now). Remind that configuring this setting to "true" generally may suit to string fields but is less favorable for data types like Date, int, long etc.. By setting to "true" you always may loose information while serializing.

Changes in version 0.9.4

Bugfixes

  • The class org.jsefa.common.validator.ValidationError is now serializable. This is useful in context with remote exceptions.

Changes in version 0.9.3

Bugfixes

  • Now uses always the prefix xml for the namespace URI http://www.w3.org/XML/1998/namespace (instead of a dynamically created one) * Fix for polymorphic type cycles (see TypeCycleTest)

New Features

  • Android support by using XmlPull instead of JSR 173 (Stax) for the android version of JSefa.
  • Added support for maps - see XmlElementMap and the two demos in the showcase dir: ComplexMapDemo and SimpleMapDemo.
  • Added defaultName annotation parameter to XmlElement annotation. This allows for specifying the default name of an element if no explicit name is given. Options are: 1) name of the field 2) default element name of the object type

Changes in version 0.9.2

Bugfixes

  • Handling of consecutive events of type CHARACTERS fixed (low level XML deserialization)

    The bug appeared using the sun implementation of Stax but not using Woodstox as the latter seems to combine the characters to one CHARACTER event.

  • Usage of primitive simple types (int, boolean etc. in contrast to Integer, Boolean etc.) for XML attributes and XML text contents fixed
  • Handling of multiple subrecord lists fixed (high level CSV/FLR)
  • Serialization of a CSV field with QuoteMode.ON_DEMAND whereas the field content starts with a quote char failed. This is fixed now.
  • Deserialization of a CSV field with more than one line break failed - only the first was read and the rest were skipped. This is fixed now.

Changed behavior

  • The default line break is now the system property line.property - was line feed (\n) before
  • xsi:type attribute default behavior

    Say you have a class Customer with the two subclasses BusinessCustomer and PrivateCustomer and another class Order with a field customer of type Customer. Further this field shall map to an xml element called <customer>. Then the deserialization of such a <customer> element without a xsi:type attribute will result in creating an instance of class Customer.

    It was not possible to deserialize a <customer> element without a xsi:type attribute before - one was forced to supply the xsi:type attribute as no default was assumed.

  • CsvLowLevelDeserializer.nextField now returns null if no next field exists (was the empty string before), the empty string if the next field is empty and a non empty field value in all other cases.
  • The default quote mode for CSV fields is now QuoteMode.ON_DEMAND - was QuoteMode.NEVER before. This new default is compliant to the RFC4180 and to what most users would expect.

    If you need the old default, you can set this once for the JVM (before creating the first Configuration) with InitialConfiguration.set(CsvInitialConfigurationParameters.DEFAUT_QUOTE_MODE, QuoteMode.NEVER).

  • FlrLowLevelDeserializer no longer throws an exception if a record contains less fields than expected. Instead the missing fields are set to null.

New Features

  • Validation (XML/CSV/FLR)

    You can now define that values are required or not using the annotation parameter "required".

    Furthermore you can impose constraints on the values using the annotation parameter "constraints", e. g. constraints = "minLength=1", "maxLength=3" for constraining the length of a String.

    Finally it is possible to define Validators on your own. See the interface Validator as the starting point for further investigations and the ValueValidationOnDeserializationTest, especially the inner class ComplexElementDTOValidator for an example of a user defined validator.

    Of course it is possible to define whether validation should be performed or not.

  • SimpleListConverter (XML/CSV/FLR)

    You can now map a list of simple types (e. g. list of integers) to a simple type of the exchange format (called simple list type). E. g. the serialization of a List<Integer> field containing the values 1,2 and 3 may result in "<element>1,2,3</element>".

    Of course you can change the delimiter with the annotation parameter "format", e. g. @XmlElement(..., format=" ") for space as the delimiter.

    This feature is especially useful when handling CSV files with a list type field whereas the delimiter for the list items differs from the field delimiter (e. g. "a;b1,b2,b3;c" has 3 fields whereas the second is a list with three elements).

    See the inner annotation SimpleListItem used for the annotation parameter listItem of several annotations (e. g. XmlElement, CsvField) and the SimpleListTypeTest.

  • InputPosition (XML/CSV/FLR deserialization)

    Each LowLevelDeserializer provides information about the current position within the input stream. This consists of the line number and column number. Each high level Deserializer provides a convenient method to retrieve this information from the underlying LowLevelDeserializer.

    Additionally a DeserializationException provides the method getInputPosition as well thus providing information about the error location.

  • Support for Set and Queue (XML/CSV/FLR)

    JSefa now supports fields of type Set and Queue. They will be handled exactly like fields of type List.

  • Flush operation for Serializer (XML/CSV/FLR)

    Each Serializer now supports flushing the buffer.

  • CDATA (XML serialization)

    You can now define that the content of an element should be a CDATA section. The default is to use entity references like &lt; to escape characters. See the enumeration TextMode and its use for several annotation paramters (e. g. XmlElement.textMode) as well as the TextModeTest.

    Note: The XmlLowLevelSerializer.writeText method now has a second parameter of type TextMode. In the rare case you use this method just add TextMode.IMPLICIT as the second argument to every call of this method.

  • DOCTYPE declaration (XML serialization)

    Using the low level serializer you can now write out a DOCTYPE declaration.

  • LineFilter (CSV/FLR deserialization)

    A line filter allows for filtering out lines during deserialization. These lines can also be stored for later retrieval. The typical use case of a line filter is to filter out and retrieve headers and footers of CSV/FLR files. See LineFilter, RbfConfiguration.setLineFilter, RbfDeserializer.getStoredLines, HeaderAndFooterFilterTest etc.

  • Support for special record delimiters (CSV/FLR)

    Typically a record is delimited by a line break. But some formats have a special record delimiter resulting in a file with one big line separated by a special character - the special record delimiter. JSefa now supports such formats (even with header and footer).

  • Accessor to LowLevelSerializer (CSV/FLR serialization)

    CsvSerializer and FlrSerializer now have a method getLowLevelSerializer to access the underlying low level serializer. Such a method existed for XmlSerializer already.

  • QuoteMode.NEVER now supports escaping of line breaks and record delimiters (CSV)

    The content of a CSV field with QuoteMode.NEVER can now contain line breaks and record delimiters.

  • Support for special "no value" string (CSV)

    By default the empty string is used to denote that a CSV field has no value. Now one can configure that a special string (e. g. "NULL") should be used instead. See the annotation parameter CsvField.noValue as well as CsvConfiguration.getDefaultNoValueString, CsvConfiguration.setDefaultNoValueString and CsvInitialConfigurationParameters.DEFAULT_NO_VALUE_STRING.

New Samples

  • samples/csv/header

    Demonstrates how to create a CSV file with a header and how to read in such a file using a LineFilter.

  • samples/csv/yellow_pages

    Demonstrates the use of sub records and sub record lists (for CSV).

  • samples/flr/yellow_pages

    Demonstrates the use of sub records and sub record lists (for FLR).

Other changes

  • The javassist based ObjectAccessorProvider is no longer part of the JSefa distribution.

    The reflection based ObjectAccessorProvider is now fast enough so that there is no need to support the one based on javassist any longer.