Package org.apache.axis2.schema.writer
Class JavaBeanWriter
- java.lang.Object
-
- org.apache.axis2.schema.writer.JavaBeanWriter
-
- All Implemented Interfaces:
BeanWriter
public class JavaBeanWriter extends Object implements BeanWriter
Java Bean writer for the schema compiler.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_ATTRIB_ARRAY_CLASS_NAME
static String
DEFAULT_ATTRIB_CLASS_NAME
static String
DEFAULT_CLASS_ARRAY_NAME
static String
DEFAULT_CLASS_NAME
static String
EXTENSION_MAPPER_CLASSNAME
static String
WRAPPED_DATABINDING_CLASS_NAME
-
Constructor Summary
Constructors Constructor Description JavaBeanWriter()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDefaultAttribArrayClassName()
String
getDefaultAttribClassName()
String
getDefaultClassArrayName()
String
getDefaultClassName()
String
getExtensionMapperPackageName()
get the mapper class package name May be ignored by the implementerMap
getModelMap()
This returns a map of Qnames vs DOMDocument models.String
getPrefixForURI(String uri)
Get a prefix for a namespace URI.String
getPrefixForURI(String uri, String defaultPrefix)
Get a prefix for the given namespace URI.void
init(CompilerOptions options)
Initializes the writer with compiler options.String
makeFullyQualifiedClassName(QName qName)
Make the fully qualified class name for an element or named typeprotected void
populateListInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElement, Map<QName,String> typeMap, Map<QName,String> groupTypeMap)
protected void
populateMemberInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElement, Map<QName,String> typeMap)
void
registerExtensionMapperPackageName(String mapperPackageName)
Sets the mapping class name of this writer.String
write(QName qName, Map<QName,String> typeMap, Map<QName,String> groupTypeMap, BeanWriterMetaInfoHolder metainf, boolean isAbstract)
`String
write(org.apache.ws.commons.schema.XmlSchemaElement element, Map<QName,String> typeMap, Map<QName,String> groupTypeMap, BeanWriterMetaInfoHolder metainf)
Write a elementString
write(org.apache.ws.commons.schema.XmlSchemaSimpleType simpleType, Map<QName,String> typeMap, Map<QName,String> groupTypeMap, BeanWriterMetaInfoHolder metainf)
Write a simple typevoid
writeBatch()
Writes a wrapped class.void
writeExtensionMapper(BeanWriterMetaInfoHolder[] metainfArray)
Write the extension classes - this is needed to process the hierarchy of classes
-
-
-
Field Detail
-
WRAPPED_DATABINDING_CLASS_NAME
public static final String WRAPPED_DATABINDING_CLASS_NAME
- See Also:
- Constant Field Values
-
EXTENSION_MAPPER_CLASSNAME
public static final String EXTENSION_MAPPER_CLASSNAME
- See Also:
- Constant Field Values
-
DEFAULT_CLASS_NAME
public static final String DEFAULT_CLASS_NAME
-
DEFAULT_CLASS_ARRAY_NAME
public static final String DEFAULT_CLASS_ARRAY_NAME
- See Also:
- Constant Field Values
-
DEFAULT_ATTRIB_CLASS_NAME
public static final String DEFAULT_ATTRIB_CLASS_NAME
-
DEFAULT_ATTRIB_ARRAY_CLASS_NAME
public static final String DEFAULT_ATTRIB_ARRAY_CLASS_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getModelMap
public Map getModelMap()
This returns a map of Qnames vs DOMDocument models. One can use this method to obtain the raw DOMmodels used to write the classes. This has no meaning when the classes are supposed to be wrapped so the- Specified by:
getModelMap
in interfaceBeanWriter
- Returns:
- Returns Map.
- See Also:
BeanWriter.getModelMap()
-
getDefaultClassName
public String getDefaultClassName()
- Specified by:
getDefaultClassName
in interfaceBeanWriter
-
getDefaultClassArrayName
public String getDefaultClassArrayName()
- Specified by:
getDefaultClassArrayName
in interfaceBeanWriter
-
getDefaultAttribClassName
public String getDefaultAttribClassName()
- Specified by:
getDefaultAttribClassName
in interfaceBeanWriter
-
getDefaultAttribArrayClassName
public String getDefaultAttribArrayClassName()
- Specified by:
getDefaultAttribArrayClassName
in interfaceBeanWriter
-
init
public void init(CompilerOptions options) throws SchemaCompilationException
Description copied from interface:BeanWriter
Initializes the writer with compiler options.- Specified by:
init
in interfaceBeanWriter
- Throws:
SchemaCompilationException
-
write
public String write(org.apache.ws.commons.schema.XmlSchemaElement element, Map<QName,String> typeMap, Map<QName,String> groupTypeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException
Description copied from interface:BeanWriter
Write a element- Specified by:
write
in interfaceBeanWriter
- Parameters:
element
-typeMap
-metainf
-- Returns:
- Returns String.
- Throws:
SchemaCompilationException
-
write
public String write(QName qName, Map<QName,String> typeMap, Map<QName,String> groupTypeMap, BeanWriterMetaInfoHolder metainf, boolean isAbstract) throws SchemaCompilationException
`- Specified by:
write
in interfaceBeanWriter
- Parameters:
qName
-typeMap
-metainf
-isAbstract
-- Returns:
- Throws:
SchemaCompilationException
-
writeBatch
public void writeBatch() throws SchemaCompilationException
Description copied from interface:BeanWriter
Writes a wrapped class. This will have effect only if the CompilerOptions wrapclassses returns true.- Specified by:
writeBatch
in interfaceBeanWriter
- Throws:
Exception
SchemaCompilationException
- See Also:
BeanWriter.writeBatch()
-
write
public String write(org.apache.ws.commons.schema.XmlSchemaSimpleType simpleType, Map<QName,String> typeMap, Map<QName,String> groupTypeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException
Description copied from interface:BeanWriter
Write a simple type- Specified by:
write
in interfaceBeanWriter
- Parameters:
simpleType
-typeMap
-metainf
-- Returns:
- Returns String.
- Throws:
SchemaCompilationException
-
makeFullyQualifiedClassName
public String makeFullyQualifiedClassName(QName qName)
Make the fully qualified class name for an element or named type- Specified by:
makeFullyQualifiedClassName
in interfaceBeanWriter
- Parameters:
qName
- the qualified Name for this element or type in the schema- Returns:
- the appropriate fully qualified class name to use in generated code
-
populateListInfo
protected void populateListInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElement, Map<QName,String> typeMap, Map<QName,String> groupTypeMap)
-
populateMemberInfo
protected void populateMemberInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElement, Map<QName,String> typeMap)
-
getPrefixForURI
public String getPrefixForURI(String uri)
Get a prefix for a namespace URI. This method will ALWAYS return a valid prefix - if the given URI is already mapped in this serialization, we return the previous prefix. If it is not mapped, we will add a new mapping and return a generated prefix of the form "ns". - Parameters:
uri
- is the namespace uri- Returns:
- Returns prefix.
-
getPrefixForURI
public String getPrefixForURI(String uri, String defaultPrefix)
Get a prefix for the given namespace URI. If one has already been defined in this serialization, use that. Otherwise, map the passed default prefix to the URI, and return that. If a null default prefix is passed, use one of the form "ns"
-
getExtensionMapperPackageName
public String getExtensionMapperPackageName()
get the mapper class package name May be ignored by the implementer- Specified by:
getExtensionMapperPackageName
in interfaceBeanWriter
-
registerExtensionMapperPackageName
public void registerExtensionMapperPackageName(String mapperPackageName)
Sets the mapping class name of this writer. A mapping class package set by the options may be overridden at the this point- Specified by:
registerExtensionMapperPackageName
in interfaceBeanWriter
- Parameters:
mapperPackageName
-
-
writeExtensionMapper
public void writeExtensionMapper(BeanWriterMetaInfoHolder[] metainfArray) throws SchemaCompilationException
Write the extension classes - this is needed to process the hierarchy of classes- Specified by:
writeExtensionMapper
in interfaceBeanWriter
- Parameters:
metainfArray
-- Throws:
SchemaCompilationException
-
-