Chapter 14 Working with Java


Selecting Java generation options

You can set the following options, available from the Options page of the Generation dialog box in Java:

Options For... Description
Sort class members primarily by Java Sorts attributes and operations by type or visibility
Generate package imports Java Used to declare import of the whole package
Class members type sort Java Sorts attributes and operations by type
Class members visibility sort Java Sorts attributes and operations by visibility
Generate object ids as JavaDoc tags Java Generates information used for reverse engineering like object identifiers (@pdoid) that are generated as documentation tags. If you do not want these tags to be generated, you have to set this option to False
Generate default accessors for navigable associations Java Generates the getter and setter methods for navigable associations
Generate Ant build.xml file Ant Generates the build.xml file. You can use this file if you have installed Ant
Generate CMP field accessors in component interfaces EJB Generates CMP fields getter and setter operations to EJB interfaces
Generate CMR field accessors in component interfaces EJB Generates CMR fields getter and setter declarations in EJB interfaces
Add Java classes source code in the JAR file EJB Includes Java classes code in the JAR
Generate value object class and associated navigation methods for CMP Entity Beans EJB Generates an additional class named %Component.Code%ValueObject for each CMP bean class and declares all the CMP fields as public attributes. In addition, a getter and a setter are generated in the bean class for each CMR relationship
Jar Web component classes J2EE Archives Web component classes in a Jar

You can set Java generation to sort the order in which the attributes and operations of the class in a Java class definition file are displayed. You can sort the order according to either visibility or member type for example.

Primary sort

You can sort the order according to the visibility or the type.

Option Result of selection
Visibility Public attributes and operations are generated before private attributes and operations in the Java file
Type Attributes and operations are sorted by type whatever their visibility

Visibility sort

You can sort the visibility order as follows:

Option Result of selection
Public – Private Public attributes and operations are generated before private attributes and operations
Private – Public Private attributes and operations are generated before public attributes and operations
None Attributes and operations order remains unchanged

Type sort

You can sort the type order as follows:

Option Result of selection
Attributes – Operations Class attributes are generated before the operations
Operations – Attributes Class operations are generated before the attributes

Generate package imports

When a class is used by another class, it is referenced by a class import:

import package1.package2.class.

The Generate package imports allows you to declare import of the whole package, it saves time whenever many classes of the same package are possibly referenced:

import package1.package2.*;

 


Copyright (C) 2005. Sybase Inc. All rights reserved.