Fixefid 3.0.0 released!

Fixefid 3.0.0 released!

The Fixefid 3.0.0 has been released.

Fixefid is a Java library for working with flat fixed formatted text files and CSV files.

A lot of improvements has been carried out:

  • Validation: now it’s possibile to obtain the validation info of all fields. That’s simplify the error management. For instance, if something goes wrong during the processing of the input string, no exception is thrown, and it’s possibile to obtain the validation error info of all fields.
  • Annotation: all configurations can be managed with annotations. The extended properties style has been maintained but only for advanced configuration, like call back needs.
  • Valid values accepted list in field annotation
  • Enum style: it’s been deprecated and not longer supported
  • Minor bug fixes and enhancements

Fixefid Home Page

Fixefid Javadoc

Fixefid Maven Repository

Advertisement

Fixefid 2.0.0 released!

Fixefid 2.0.0 released!

I’m very proud to announce Fixefid 2.0.0 has been released!

Fixefid is a Java library for working with flat fixed formatted text files and CSV files.

The version 2.0.0 includes:

  • Java 8
  • CSV Record
  • Annotations for record and field extended properties
  • Fields Occurrences and subOrdinal
  • Simple Boolean Format
  • Logging
  • Minor bug fixes and enhancements

Fixefid Home Page

Fixefid Javadoc

Fixefid Maven Repository

Howto deal with fixed fields text record without substring

Howto avoid substring approach to deal with fixed fields formatted text records. The solution is the Java library Fixefid

Often we have to develop Java methods to deal with fixed fields formatted text records. The format is often used nowadays yet to files transfer between mainframe and unix machines. Almost always the approach is using substring like this:

String address = record.substring(10, 20);
String location = record.substring(20, 30);

But that is an error prone pattern. The records are length thousands of chars with many many fields and make a mistake with the offset is not so rarely. And moreover when you have to format the fields to create the record, you have to deal with string right padding, zero lead numeric left padding, boolean format, date format, decimal format, decimal separator, etc etc…

The solution is using a Java library like Fixefid, wich permits to start from a specification in excel, model the record with Java Bean or Java Enum and deal with fields by getter, setter and toString Java methods.

I’ve made a video tutorial where I explain in the detail way the process to start from an excel like this:

to create a Java Bean model like this:

to obtain a records txt file like this:

In this way we can using the standard java bean development to deal with fixed fields formatted text files.

For example you can create a Java Bean like this:

@FixefidRecord(recordLen = 600)
public class Student extends Person {
@FixefidField(fieldLen = 10, fieldOrdinal = 8, fieldType = FieldType.N,       
         fieldMandatory = FieldMandatory.INOUT)
private Long studentId;
….
}

and create a BeanRecord like this:

Student student = createStudent();
BeanRecord studentRecord = new BeanRecord(student, null, null, 
       createStudentMapFieldExtendedProperties());
studentRecord.toNormalize();
String studentRecordAsString = studentRecord.toString();
System.out.println("Student Record=[" + studentRecordAsString + "]");

The video tutorial explains the whole process in the detail way.

Here the java project developed on the video tutorial.

If you don’t want to use Java Bean, the same record can be modeled with Java Enum.