Package org.apache.axis2.schema.writer
Class CStructWriter
- java.lang.Object
-
- org.apache.axis2.schema.writer.CStructWriter
-
- All Implemented Interfaces:
BeanWriter
public class CStructWriter extends Object implements BeanWriter
Java Bean writer for the schema compiler.
-
-
Field Summary
Fields Modifier and Type Field Description static StringAXIS2_PREFIXstatic StringDEFAULT_ATTRIB_ARRAY_CLASS_NAMEstatic StringDEFAULT_ATTRIB_CLASS_NAMEstatic StringDEFAULT_CLASS_ARRAY_NAMEstatic StringDEFAULT_CLASS_NAMEstatic StringDEFAULT_TYPE_NSstatic StringEXTENSION_MAPPER_CLASSNAMEprotected FilerootDirstatic StringWRAPPED_DATABINDING_CLASS_NAME
-
Constructor Summary
Constructors Constructor Description CStructWriter()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FilecreateOutFile(String fileName, String extension, String prefix)Creates the output fileStringgetDefaultAttribArrayClassName()StringgetDefaultAttribClassName()StringgetDefaultClassArrayName()StringgetDefaultClassName()StringgetExtensionMapperPackageName()Keep unimplementedMapgetModelMap()This returns a map of Qnames vs DOMDocument models.StringgetPrefixForURI(String uri)Get a prefix for a namespace URI.StringgetPrefixForURI(String uri, String defaultPrefix)Get a prefix for the given namespace URI.voidinit(CompilerOptions options)Initializes the writer with compiler options.StringmakeFullyQualifiedClassName(QName qName)Make the fully qualified class name for an element or named typeprotected voidpopulateListInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElement, Map<QName,String> typeMap, Map<QName,String> groupTypeMap)protected voidpopulateMemberInfo(BeanWriterMetaInfoHolder metainf, Document model, Element rootElement, Map<QName,String> typeMap)voidregisterExtensionMapperPackageName(String mapperPackageName)Keep unimplementedStringwrite(QName qName, Map<QName,String> typeMap, Map<QName,String> groupTypeMap, BeanWriterMetaInfoHolder metainf, boolean isAbstract)Write a complex typeStringwrite(org.apache.ws.commons.schema.XmlSchemaElement element, Map<QName,String> typeMap, Map<QName,String> groupTypeMap, BeanWriterMetaInfoHolder metainf)Write a elementStringwrite(org.apache.ws.commons.schema.XmlSchemaSimpleType simpleType, Map<QName,String> typeMap, Map<QName,String> groupTypeMap, BeanWriterMetaInfoHolder metainf)Write a simple typevoidwriteBatch()Writes a wrapped class.voidwriteExtensionMapper(BeanWriterMetaInfoHolder[] metainfArray)Generate the Extension Mapper module.
-
-
-
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
-
AXIS2_PREFIX
public static final String AXIS2_PREFIX
- See Also:
- Constant Field Values
-
rootDir
protected File rootDir
-
DEFAULT_CLASS_NAME
public static final String DEFAULT_CLASS_NAME
- See Also:
- Constant Field Values
-
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
- See Also:
- Constant Field Values
-
DEFAULT_ATTRIB_ARRAY_CLASS_NAME
public static final String DEFAULT_ATTRIB_ARRAY_CLASS_NAME
- See Also:
- Constant Field Values
-
DEFAULT_TYPE_NS
public static final String DEFAULT_TYPE_NS
- 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:
getModelMapin interfaceBeanWriter- Returns:
- Returns Map.
- See Also:
BeanWriter.getModelMap()
-
getDefaultClassName
public String getDefaultClassName()
- Specified by:
getDefaultClassNamein interfaceBeanWriter
-
getDefaultClassArrayName
public String getDefaultClassArrayName()
- Specified by:
getDefaultClassArrayNamein interfaceBeanWriter
-
getDefaultAttribClassName
public String getDefaultAttribClassName()
- Specified by:
getDefaultAttribClassNamein interfaceBeanWriter
-
getDefaultAttribArrayClassName
public String getDefaultAttribArrayClassName()
- Specified by:
getDefaultAttribArrayClassNamein interfaceBeanWriter
-
init
public void init(CompilerOptions options) throws SchemaCompilationException
Description copied from interface:BeanWriterInitializes the writer with compiler options.- Specified by:
initin 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:BeanWriterWrite a element- Specified by:
writein 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
Description copied from interface:BeanWriterWrite a complex type- Specified by:
writein interfaceBeanWriter- Parameters:
qName-typeMap-metainf-isAbstract-- Returns:
- Returns String.
- Throws:
SchemaCompilationException- See Also:
BeanWriter
-
writeBatch
public void writeBatch() throws SchemaCompilationExceptionDescription copied from interface:BeanWriterWrites a wrapped class. This will have effect only if the CompilerOptions wrapclassses returns true.- Specified by:
writeBatchin interfaceBeanWriter- Throws:
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:BeanWriterWrite a simple type- Specified by:
writein 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:
makeFullyQualifiedClassNamein 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)
-
createOutFile
protected File createOutFile(String fileName, String extension, String prefix) throws Exception
Creates the output file- Parameters:
fileName-extension-- Throws:
Exception
-
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"
-
registerExtensionMapperPackageName
public void registerExtensionMapperPackageName(String mapperPackageName)
Keep unimplemented- Specified by:
registerExtensionMapperPackageNamein interfaceBeanWriter- Parameters:
mapperPackageName-- See Also:
BeanWriter.registerExtensionMapperPackageName(String)
-
writeExtensionMapper
public void writeExtensionMapper(BeanWriterMetaInfoHolder[] metainfArray) throws SchemaCompilationException
Generate the Extension Mapper module. This provides pseudo-polymorphism support to the generated code, allowing to send and receive derived classes in requests/replies that expect a base class.- Specified by:
writeExtensionMapperin interfaceBeanWriter- Parameters:
metainfArray-- Throws:
SchemaCompilationException- See Also:
BeanWriter.writeExtensionMapper(org.apache.axis2.schema.BeanWriterMetaInfoHolder[])
-
getExtensionMapperPackageName
public String getExtensionMapperPackageName()
Keep unimplemented- Specified by:
getExtensionMapperPackageNamein interfaceBeanWriter- See Also:
BeanWriter.getExtensionMapperPackageName()
-
-