@Records within @Records

47 views
Skip to first unread message

hoffmandirt

unread,
Oct 23, 2008, 8:15:26 AM10/23/08
to Fixedformat4j User List
I was trying to use a @Record within a @Record and I wasn't having any
luck. Is this possible in 1.2.1? Note the KeyOfficialRecord has a
FileHeader in it below. I know inheritance would work, but I have an
instance where composition would work a lot better.

@Record
public class FileHeader {
private String versionTag;
private Integer sequenceNumber;
private int officialNumber;
private Date dateStamp;
private Date cancelDateStamp;
private String submitterName;
private String submitterTitle;
private String submitterTelephone;

/**
* Gets the version tag.
* @return The version tag.
*/
@Field(offset = 1, length = 4)
public String getVersionTag() {
return versionTag;
}

/**
* Sets the version tag.
* @param versionTag The version tag.
*/
public void setVersionTag(String versionTag) {
this.versionTag = versionTag;
}

/**
* @return the sequenceNumber
*/
@Field(offset = 5, length = 6, align = Align.RIGHT, paddingChar =
'0' )
public Integer getSequenceNumber() {
return sequenceNumber;
}

/**
* @param sequenceNumber the sequenceNumber to set
*/
public void setSequenceNumber(Integer sequenceNumber) {
this.sequenceNumber = sequenceNumber;
}

...
}

@Record
public class KeyOfficialRecord {
private FileHeader fileHeader;

/**
* @return the fileHeader
*/
@Field(offset = 1, length = 132)
public FileHeader getFileHeader() {
return fileHeader;
}

/**
* @param fileHeader the fileHeader to set
*/
public void setFileHeader(FileHeader fileHeader) {
this.fileHeader = fileHeader;
}

...
}

Jacob von Eyben

unread,
Oct 23, 2008, 10:28:18 AM10/23/08
to Fixedformat4j User List
This is comming up very soon in the 1.3.0 release.
See issue:
http://code.google.com/p/fixedformat4j/issues/detail?id=7&can=1&colspec=ID%20Type%20Status%20Priority%20Affected%20Fix%20Owner%20Summary

Unfortunately I am not finished with it yet :-(

But as I see your code it would fit right into the upcomming release.

If you need it in a hurry, feel free to download the trunk the source
and run mvn install. Even though it is bleeding edge it should be
stable.

I hope to release the 1.3.0 within a week or so.

Regards Jacob

hoffmandirt

unread,
Oct 27, 2008, 1:51:03 PM10/27/08
to Fixedformat4j User List
Thanks for the update. I will wait for the 1.3.0 release. I am
currently testing out a few more parsing tools as well.

On Oct 23, 10:28 am, Jacob von Eyben <jacobvoney...@gmail.com> wrote:
> This is comming up very soon in the 1.3.0 release.
> See issue:http://code.google.com/p/fixedformat4j/issues/detail?id=7&can=1&colsp...
> > }- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages