inner classes?

28 views
Skip to first unread message

ganncamp

unread,
Jun 4, 2009, 1:25:17 PM6/4/09
to Fixedformat4j User List, ann.ca...@shawinc.com
I'm dealing with mainframe records like this:

ATable
[column] [size]
val1 5
val1uom 6
val2 4
val2uom 4
val3 4
val3uom 6
...

Where "uom" = units of measurement

I had hoped to be able to tidy these pairs into "Measurement" class
instances within my larger, ATable class.

But now that I come to the point of annotating ATable.java, I'm stuck
on to go about that.

My guess was that I might use the @Fields annotation like so:


@Fields{
@Field(offset=9, length=5)
@Field(offset=14, length=6)
}
public Measurement getVal1()
{
return this.val1;
}


But these how do the two fields get assigned within the Measurement
class?

I hope my question is clear - I'm finding it difficult to articulate.


Thanks!
Ann

ganncamp

unread,
Jun 5, 2009, 4:37:47 PM6/5/09
to Fixedformat4j User List
I figured it out. The answer is to add getters/setters for the child
class' members & annotate them. Duh!

E.g.
public class ATable
{
protected Measurement val1;
[much omitted]

@Field(offset=n size=5)
public BigDecimal getVal1Value(){
return val1.getValue();
}

public void setVal1Value(BigDecimal value){
val1.setValue(value);
}

public Measurement getVal1() {
return val1;
}

public void setVal1(Measurement value) {
val1 = value;
}


&etc

Ann
Reply all
Reply to author
Forward
0 new messages