开发者

Custom reflection in J2ME

开发者 https://www.devze.com 2023-02-25 18:43 出处:网络
recently I\'ve developed a protocol serializer/deserializer using anotations and reflection. The final result wa开发者_如何学Gos like this:

recently I've developed a protocol serializer/deserializer using anotations and reflection. The final result wa开发者_如何学Gos like this:

class oneCommElement extends BaseProtocolType{

@Position(0)
otherProtocolType o1;

@Position(1)
otherProtocolType2 o2;

}

that way I caniterate every elements using reflection.

But now I want to make this in J2ME (for insertion of bluetooth communications), and there I loose the reflection.

My question is: Can we develop some custom reflection just to have Filed.set and Filed.get ?


There is no reflection, so you cannot get the Fields. You will have to make some kind of custom getter and setter code in the objects you want so serialize and deserialize - it will be ugly and I recommend you follow another path.

0

精彩评论

暂无评论...
验证码 换一张
取 消