Importing Java Classes
The Java representation allows you to transform Java object instances. You can import Java classes individually, from a folder, or in a JAR file, and the Java importer will create structure definitions from each class. At runtime you can provide Java object(s) as the source(s) of a transformation or accept them as the result(s).
-
Select - Here you select the classes to import. Each class is read and any other classes that this class depends on is also processed (for example references classes or superclasses). These dependent classes are resolved using the classpath (specified at the bottom of the properties). Initially, the classpath is setup to be identical to the entries selected for import, but there are some cases where you will not want this. For example, if you are selecting folders containing classes to import, you may only want certain folders, but in order to resolve any classes correctly your classpath needs to point to the enclosing top-level folder (like the bin folder).
If you are using the Java Subclass Generation (see below, and selected by default) to generate the choices for each subclass, then you must select all desired subclasses here.
Use the buttons on the side of the select area to add either resources (folders or files), external Jar or class files, or external folders. When a folder (resource or external) is specified, any JAR or class files contained it or any descendent folders are also examined (descendent folders are not examined when you turn off Include Subpackages below).
Typically you would specify the bin folder of the project you are interested in to get all classes in the project. However, you can specify any package level to get only the classes in that package.
Whatever you specify here automatically becomes the Classpath (see below) if you don't specify anything else for the classpath.
By default, all classes in a selected folder are imported. If you wish to import only classes at the level that you select and no subpackages, select a folder or folders that contains classes and then turn off the Include Subpackages option.
-
Create Elements From - You can specify fields, which creates the structure elements from the fields of your classes, or specify Bean Properties to create the structure elements from the JavaBean properties.
-
Include Deprecated Fields/Properties - By default deprecated fields or properties are includes. Turn this off if you don't want them to be.
-
Create Structures As - You can control how the structures are named based on the class of the objects. Note that for small numbers of objects, using the simple class names can make things more manageable.
-
Handling References to Classes Having Subclasses - See Java Subclass Generation below.
-
Classpath - When processing the Java classes for import, dependent classes must be resolved against a classpath. This is where you can add JAR files or folders (which can be either external or resources) to the classpath. If you don't specify anything, the selected file/resource/folders you are importing becomes the classpath.
See also the common properties associated with representations.