Top Description Fields Constructors Methods
com.sun.tools.xjc.generator.bean

public final Class BeanGenerator

extends Object
implements Outline
Class Inheritance
All Implemented Interfaces
com.sun.tools.xjc.outline.Outline
Static Imports
com.sun.tools.xjc.outline.Aspect.EXPOSED

Generates fields and accessors.

Field Summary

Modifier and TypeField and Description
private final Map<CClassInfo, ClassOutlineImpl>
private final JCodeModel
private final CodeModelClassFactory
codeModelClassFactory

Simplifies class/interface creation and collision detection.

pack-priv final Map<CElementInfo, ElementOutlineImpl>
elements

elements that generate classes to the generated classes.

private final Map<CEnumLeafInfo, EnumOutline>
enums

all EnumOutlines keyed by their EnumOutline#target.

private final ErrorReceiver
private final CClassInfoParent.Visitor<JClassContainer>
private final Map<CPropertyInfo, FieldOutline>
fields

for each property, the information about the generated field.

private final Map<Class<?>, JClass>
generatedRuntime

Generated runtime classes.

private final CClassInfoParent.Visitor<JClassContainer>
private static final String
JAXB_PACKAGE

JAXB module name.

private final Model
model

the model object which we are processing.

private final Map<JPackage, PackageOutlineImpl>

Constructor Summary

AccessConstructor and Description
private
BeanGenerator(Model _model, ErrorReceiver _errorReceiver)

Method Summary

Modifier and TypeMethod and Description
public JClass
addRuntime(Class<?> clazz)

Implements com.sun.tools.xjc.outline.Outline.addRuntime.

Copies the specified class into the user's package and returns a reference to it.

public static Outline

Returns:

returns a Outline which will in turn be used to further generate marshaller/unmarshaller, or null if the processing fails (errors should have been reported to the error recevier.)
generate
(Model model, ErrorReceiver
This object will receive all the errors discovered during the back-end stage.
_errorReceiver
)

Generates beans into code model according to the BGM, and produces the reflection model.

public void
private void
generateAttributeWildcard(ClassOutlineImpl cc)

Generates an attribute wildcard property on a class.

private void
generateClassBody(ClassOutlineImpl cc)

Generates the body of a class.

private ClassOutlineImpl
generateClassDef(CClassInfo bean)

Generates the minimum JDefinedClass skeleton without filling in its body.

private void
generateClassList()

Generates a class that knows how to create an instance of JAXBContext

This is used in the debug mode so that a new properly configured JAXBContext object can be used.

private void
private EnumOutline
generateEnumDef(CEnumLeafInfo e)

Generates the minimum JDefinedClass skeleton without filling in its body.

private FieldOutline
generateFieldDecl(ClassOutlineImpl cc, CPropertyInfo prop)

Determines the FieldRenderer used for the given FieldUse, then generates the field declaration and accessor methods.

public JClass
public Iterable<? extends PackageOutline>
getAllPackageContexts()

Implements com.sun.tools.xjc.outline.Outline.getAllPackageContexts.

Gets all package-wise contexts at once.

public Collection<ClassOutlineImpl>
getClasses()

Implements com.sun.tools.xjc.outline.Outline.getClasses.

Returns all the ClassOutlines known to this object.

public CodeModelClassFactory
getClassFactory()

Implements com.sun.tools.xjc.outline.Outline.getClassFactory.

Gets a reference to new CodeModelClassFactory(getErrorHandler()).

public ClassOutlineImpl
getClazz(CClassInfo bean)

Implements com.sun.tools.xjc.outline.Outline.getClazz.

Obtains per-class context information.

public JCodeModel
getCodeModel()

Implements com.sun.tools.xjc.outline.Outline.getCodeModel.

Short for getModel().codeModel.

public JClassContainer
public ElementOutline
getElement(CElementInfo ei)

Implements com.sun.tools.xjc.outline.Outline.getElement.

If the CElementInfo generates a class, returns such a class.

public EnumOutline
public Collection<EnumOutline>
public ErrorReceiver
getErrorReceiver()

Implements com.sun.tools.xjc.outline.Outline.getErrorReceiver.

Any error during the back-end proccessing should be sent to this object.

public FieldOutline
getField(CPropertyInfo prop)

Implements com.sun.tools.xjc.outline.Outline.getField.

Gets the object that wraps the generated field for a given CPropertyInfo.

public Model
getModel()

Implements com.sun.tools.xjc.outline.Outline.getModel.

This outline is for this model.

public PackageOutlineImpl
getPackageContext(JPackage p)

Implements com.sun.tools.xjc.outline.Outline.getPackageContext.

Gets per-package context information.

private String
public JPackage[]

Returns:

Given the same input, the order of packages in the array is always the same regardless of the environment.
getUsedPackages
(Aspect aspect)

Returns all used JPackages.

public JType
resolve(CTypeRef ref, Aspect a)

Implements com.sun.tools.xjc.outline.Outline.resolve.

Resolves a type reference to the actual (possibly generated) type.

private void
writeTypeName(QName typeName, XmlTypeWriter xtw, String mostUsedNamespaceURI)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classesback to summary
private final Map<CClassInfo, ClassOutlineImpl> classes

all ClassOutlines keyed by their ClassOutline#target.

codeModelback to summary
private final JCodeModel codeModel
codeModelClassFactoryback to summary
private final CodeModelClassFactory codeModelClassFactory

Simplifies class/interface creation and collision detection.

elementsback to summary
pack-priv final Map<CElementInfo, ElementOutlineImpl> elements

elements that generate classes to the generated classes.

enumsback to summary
private final Map<CEnumLeafInfo, EnumOutline> enums

all EnumOutlines keyed by their EnumOutline#target.

errorReceiverback to summary
private final ErrorReceiver errorReceiver
exposedContainerBuilderback to summary
private final CClassInfoParent.Visitor<JClassContainer> exposedContainerBuilder
fieldsback to summary
private final Map<CPropertyInfo, FieldOutline> fields

for each property, the information about the generated field.

generatedRuntimeback to summary
private final Map<Class<?>, JClass> generatedRuntime

Generated runtime classes.

implContainerBuilderback to summary
private final CClassInfoParent.Visitor<JClassContainer> implContainerBuilder
JAXB_PACKAGEback to summary
private static final String JAXB_PACKAGE

JAXB module name. JAXB dependency is mandatory in generated Java module.

modelback to summary
private final Model model

the model object which we are processing.

packageContextsback to summary
private final Map<JPackage, PackageOutlineImpl> packageContexts

all PackageOutlines keyed by their PackageOutline#_package.

Constructor Detail

BeanGeneratorback to summary
private BeanGenerator(Model _model, ErrorReceiver _errorReceiver)

Method Detail

addRuntimeback to summary
public JClass addRuntime(Class<?> clazz)

Implements com.sun.tools.xjc.outline.Outline.addRuntime.

Doc from com.sun.tools.xjc.outline.Outline.addRuntime.

Copies the specified class into the user's package and returns a reference to it.

Annotations
@Override
generateback to summary
public static Outline generate(Model model, ErrorReceiver _errorReceiver)

Generates beans into code model according to the BGM, and produces the reflection model.

Parameters
_errorReceiver:ErrorReceiver

This object will receive all the errors discovered during the back-end stage.

Returns:Outline

returns a Outline which will in turn be used to further generate marshaller/unmarshaller, or null if the processing fails (errors should have been reported to the error recevier.)

generateAdapterIfNecessaryback to summary
public void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field)

Generates XmlJavaTypeAdapter from PropertyInfo if necessary. Also generates other per-property annotations (such as XmlID, XmlIDREF, and XmlMimeType if necessary.

generateAttributeWildcardback to summary
private void generateAttributeWildcard(ClassOutlineImpl cc)

Generates an attribute wildcard property on a class.

generateClassBodyback to summary
private void generateClassBody(ClassOutlineImpl cc)

Generates the body of a class.

generateClassDefback to summary
private ClassOutlineImpl generateClassDef(CClassInfo bean)

Generates the minimum JDefinedClass skeleton without filling in its body.

generateClassListback to summary
private void generateClassList()

Generates a class that knows how to create an instance of JAXBContext

This is used in the debug mode so that a new properly configured JAXBContext object can be used.

generateEnumBodyback to summary
private void generateEnumBody(EnumOutline eo)
generateEnumDefback to summary
private EnumOutline generateEnumDef(CEnumLeafInfo e)

Generates the minimum JDefinedClass skeleton without filling in its body.

generateFieldDeclback to summary
private FieldOutline generateFieldDecl(ClassOutlineImpl cc, CPropertyInfo prop)

Determines the FieldRenderer used for the given FieldUse, then generates the field declaration and accessor methods. The fields map will be updated with the newly created FieldRenderer.

generateStaticClassback to summary
public JClass generateStaticClass(Class<?> src, JPackage out)
getAllPackageContextsback to summary
public Iterable<? extends PackageOutline> getAllPackageContexts()

Implements com.sun.tools.xjc.outline.Outline.getAllPackageContexts.

Doc from com.sun.tools.xjc.outline.Outline.getAllPackageContexts.

Gets all package-wise contexts at once.

Annotations
@Override
getClassesback to summary
public Collection<ClassOutlineImpl> getClasses()

Implements com.sun.tools.xjc.outline.Outline.getClasses.

Doc from com.sun.tools.xjc.outline.Outline.getClasses.

Returns all the ClassOutlines known to this object.

Annotations
@Override
getClassFactoryback to summary
public CodeModelClassFactory getClassFactory()

Implements com.sun.tools.xjc.outline.Outline.getClassFactory.

Doc from com.sun.tools.xjc.outline.Outline.getClassFactory.

Gets a reference to new CodeModelClassFactory(getErrorHandler()).

Annotations
@Override
getClazzback to summary
public ClassOutlineImpl getClazz(CClassInfo bean)

Implements com.sun.tools.xjc.outline.Outline.getClazz.

Doc from com.sun.tools.xjc.outline.Outline.getClazz.

Obtains per-class context information.

Annotations
@Override
getCodeModelback to summary
public JCodeModel getCodeModel()

Implements com.sun.tools.xjc.outline.Outline.getCodeModel.

Doc from com.sun.tools.xjc.outline.Outline.getCodeModel.

Short for getModel().codeModel.

Annotations
@Override
getContainerback to summary
public JClassContainer getContainer(CClassInfoParent parent, Aspect aspect)

Implements com.sun.tools.xjc.outline.Outline.getContainer.

Annotations
@Override
getElementback to summary
public ElementOutline getElement(CElementInfo ei)

Implements com.sun.tools.xjc.outline.Outline.getElement.

Doc from com.sun.tools.xjc.outline.Outline.getElement.

If the CElementInfo generates a class, returns such a class. Otherwise return null.

Annotations
@Override
getEnumback to summary
public EnumOutline getEnum(CEnumLeafInfo eli)

Implements com.sun.tools.xjc.outline.Outline.getEnum.

Annotations
@Override
getEnumsback to summary
public Collection<EnumOutline> getEnums()

Implements com.sun.tools.xjc.outline.Outline.getEnums.

Doc from com.sun.tools.xjc.outline.Outline.getEnums.

Gets all the EnumOutlines.

Annotations
@Override
getErrorReceiverback to summary
public ErrorReceiver getErrorReceiver()

Implements com.sun.tools.xjc.outline.Outline.getErrorReceiver.

Doc from com.sun.tools.xjc.outline.Outline.getErrorReceiver.

Any error during the back-end proccessing should be sent to this object.

Annotations
@Override
getFieldback to summary
public FieldOutline getField(CPropertyInfo prop)

Implements com.sun.tools.xjc.outline.Outline.getField.

Doc from com.sun.tools.xjc.outline.Outline.getField.

Gets the object that wraps the generated field for a given CPropertyInfo.

Annotations
@Override
getModelback to summary
public Model getModel()

Implements com.sun.tools.xjc.outline.Outline.getModel.

Doc from com.sun.tools.xjc.outline.Outline.getModel.

This outline is for this model.

Annotations
@Override
getPackageContextback to summary
public PackageOutlineImpl getPackageContext(JPackage p)

Implements com.sun.tools.xjc.outline.Outline.getPackageContext.

Doc from com.sun.tools.xjc.outline.Outline.getPackageContext.

Gets per-package context information. This method works for every visible package (those packages which are supposed to be used by client applications.)

Annotations
@Override
getShortNameback to summary
private String getShortName(Class<?> src)
getUsedPackagesback to summary
public JPackage[] getUsedPackages(Aspect aspect)

Returns all used JPackages. A JPackage is considered as "used" if a ClassItem or a InterfaceItem resides in that package. This value is dynamically calculated every time because one can freely remove ClassItem/InterfaceItem.

Returns:JPackage[]

Given the same input, the order of packages in the array is always the same regardless of the environment.

resolveback to summary
public JType resolve(CTypeRef ref, Aspect a)

Implements com.sun.tools.xjc.outline.Outline.resolve.

Doc from com.sun.tools.xjc.outline.Outline.resolve.

Resolves a type reference to the actual (possibly generated) type. Short for resolve(ref.getType(),aspect).

Annotations
@Override
writeTypeNameback to summary
private void writeTypeName(QName typeName, XmlTypeWriter xtw, String mostUsedNamespaceURI)