FieldDef fd = new FieldDef(Scope.PUBLIC,new TypeName(type),"foo") ;
fd = fd.setStatic(true) ;
cd = cd.addField(fd) ;
{
Var x = new Var(0,new TypeName(type)) ;
MethodDef md = new MethodDef(TypeName.VOID,"setFoo",x) ;
md = md.setStatic(true) ;
md = md.addInstructions(
new Load(x),
new Store(new StaticFieldRef(cd.name,new TypeName(type),"foo")),
new Return(TypeCode.VOID)
) ;
cd = cd.addMethod(md) ;
}
{
MethodDef md = new MethodDef(new TypeName(type),"getFoo") ;
md = md.setStatic(true) ;
md = md.addInstructions(
new Load(new StaticFieldRef(cd.name,new TypeName(type),"foo")),
new Return(TypeCode.getType(type))
) ;
cd = cd.addMethod(md) ;
}