|
|||
![]() |
|||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||
|
2.2. Defining customized class-file attributesThe class-files of Java consist of different attributes, as shown in chapter XXX. Beside the standard attributes defined by Sun, of which some are required and some are optional, the format of the class-files allows you to define your own, customized attributes. You have to follow some simple conventions to do so. XJBC will enable you define your own customized attributes. This section will describe how to do that. Writing a pair of parser and generator of the format. How to include it into the library, i.e. make it callable from within. Deployment of your customized parser and generator. 2.2.1. Using the 'Unknown'-attributeYou can directly use the unknown-attribute to write and read your customized attributes. This is simply accomplished with XML and you mustn't provide a parser and generator. You simply write the bytes into the attribute in XML and can read them this way. 2.2.2. Providing a parser and generatorThis is more work to do, because you have to parse an attribute into XML, i.e. generate appropriate SAX2-events, and you have to generate bytecode from XML, i.e. parse appropriate SAX2-events. This is very advanced and described in this section. |
||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||
|
©2003, tangentum.com
All rights reserved.
|
|||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||