Package com.sun.tools.xjc.generator.bean
Class BeanGenerator
- java.lang.Object
-
- com.sun.tools.xjc.generator.bean.BeanGenerator
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JClassaddRuntime(Class clazz)Copies the specified class into the user's package and returns a reference to it.static Outlinegenerate(Model model, ErrorReceiver _errorReceiver)Generates beans into code model according to the BGM, and produces the reflection model.voidgenerateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field)GeneratesXmlJavaTypeAdapterfromPropertyInfoif necessary.JClassgenerateStaticClass(Class src, JPackage out)Iterable<? extends PackageOutline>getAllPackageContexts()Gets all package-wise contexts at once.Collection<ClassOutlineImpl>getClasses()Returns all theClassOutlines known to this object.CodeModelClassFactorygetClassFactory()Gets a reference tonew CodeModelClassFactory(getErrorHandler()).ClassOutlineImplgetClazz(CClassInfo bean)Obtains per-class context information.JCodeModelgetCodeModel()Short forgetModel().codeModel.JClassContainergetContainer(CClassInfoParent parent, Aspect aspect)com.sun.tools.xjc.generator.bean.ElementOutlineImplgetElement(CElementInfo ei)If theCElementInfogenerates a class, returns such a class.EnumOutlinegetEnum(CEnumLeafInfo eli)Collection<EnumOutline>getEnums()Gets all theEnumOutlines.ErrorReceivergetErrorReceiver()Any error during the back-end proccessing should be sent to this object.FieldOutlinegetField(CPropertyInfo prop)Gets the object that wraps the generated field for a givenCPropertyInfo.ModelgetModel()This outline is for this model.PackageOutlineImplgetPackageContext(JPackage p)Gets per-package context information.JPackage[]getUsedPackages(Aspect aspect)Returns all used JPackages.JTyperesolve(CTypeRef ref, Aspect a)Resolves a type reference to the actual (possibly generated) type.
-
-
-
Method Detail
-
generate
public static Outline generate(Model model, ErrorReceiver _errorReceiver)
Generates beans into code model according to the BGM, and produces the reflection model.- Parameters:
_errorReceiver- This object will receive all the errors discovered during the back-end stage.- Returns:
- returns a
Outlinewhich 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.)
-
getModel
public Model getModel()
Description copied from interface:OutlineThis outline is for this model.
-
getCodeModel
public JCodeModel getCodeModel()
Description copied from interface:OutlineShort forgetModel().codeModel.- Specified by:
getCodeModelin interfaceOutline
-
getContainer
public JClassContainer getContainer(CClassInfoParent parent, Aspect aspect)
- Specified by:
getContainerin interfaceOutline
-
resolve
public final JType resolve(CTypeRef ref, Aspect a)
Description copied from interface:OutlineResolves a type reference to the actual (possibly generated) type. Short forresolve(ref.getType(),aspect).
-
getUsedPackages
public final 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:
- Given the same input, the order of packages in the array is always the same regardless of the environment.
-
getErrorReceiver
public ErrorReceiver getErrorReceiver()
Description copied from interface:OutlineAny error during the back-end proccessing should be sent to this object.- Specified by:
getErrorReceiverin interfaceOutline
-
getClassFactory
public CodeModelClassFactory getClassFactory()
Description copied from interface:OutlineGets a reference tonew CodeModelClassFactory(getErrorHandler()).- Specified by:
getClassFactoryin interfaceOutline
-
getPackageContext
public PackageOutlineImpl getPackageContext(JPackage p)
Description copied from interface:OutlineGets per-package context information. This method works for every visible package (those packages which are supposed to be used by client applications.)- Specified by:
getPackageContextin interfaceOutline- Returns:
- If this grammar doesn't produce anything in the specified package, return null.
-
getClasses
public Collection<ClassOutlineImpl> getClasses()
Description copied from interface:OutlineReturns all theClassOutlines known to this object.- Specified by:
getClassesin interfaceOutline
-
getClazz
public ClassOutlineImpl getClazz(CClassInfo bean)
Description copied from interface:OutlineObtains per-class context information.
-
getElement
public com.sun.tools.xjc.generator.bean.ElementOutlineImpl getElement(CElementInfo ei)
Description copied from interface:OutlineIf theCElementInfogenerates a class, returns such a class. Otherwise return null.- Specified by:
getElementin interfaceOutline
-
getEnum
public EnumOutline getEnum(CEnumLeafInfo eli)
-
getEnums
public Collection<EnumOutline> getEnums()
Description copied from interface:OutlineGets all theEnumOutlines.
-
getAllPackageContexts
public Iterable<? extends PackageOutline> getAllPackageContexts()
Description copied from interface:OutlineGets all package-wise contexts at once.- Specified by:
getAllPackageContextsin interfaceOutline
-
getField
public FieldOutline getField(CPropertyInfo prop)
Description copied from interface:OutlineGets the object that wraps the generated field for a givenCPropertyInfo.
-
generateAdapterIfNecessary
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field)
GeneratesXmlJavaTypeAdapterfromPropertyInfoif necessary. Also generates other per-property annotations (such asXmlID,XmlIDREF, andXmlMimeTypeif necessary.
-
addRuntime
public final JClass addRuntime(Class clazz)
Description copied from interface:OutlineCopies the specified class into the user's package and returns a reference to it.- Specified by:
addRuntimein interfaceOutline
-
-