public static QName getItemType(TypeEntry te) { if (te instanceof DefinedElement) { te = te.getRefType(); } return te.getComponentType(); } } // class Utils
/** * Returns the appropriate extends text * * @return "" or " extends <class> " */ protected String getExtendsText() { // See if this class extends another class String extendsText = ""; if ((extendType != null) && !isUnion() && (!type.isSimpleType() || !extendType.isBaseType()) && (extendType.getDimensions().length() == 0)) { extendsText = " extends " + extendType.getName() + " "; } return extendsText; }
public static boolean shouldEmit(TypeEntry type) { // 1) Don't register types that are base (primitive) types // or attributeGroups or xs:groups. // If the baseType != null && getRefType() != null this // is a simpleType that must be registered. // 2) Don't register the special types for collections // (indexed properties) or elements // 3) Don't register types that are not referenced // or only referenced in a literal context. return (!(((type.getBaseType() != null) && (type.getRefType() == null)) || (type instanceof CollectionTE) || (type instanceof Element) || !type.isReferenced() || type.isOnlyLiteralReferenced() || ((type.getNode() != null) && (isXsNode(type.getNode(), "group") || isXsNode(type.getNode(), "attributeGroup"))))); }
String dims = tEntry.getDimensions(); TypeEntry refType = tEntry.getRefType(); while (refType != null) { tEntry = refType; dims += tEntry.getDimensions(); refType = tEntry.getRefType(); if (Utils.getEnumerationBaseAndValues(te.getNode(), symbolTable) == null &&SchemaUtils.getComplexElementExtensionBase(te.getNode(), symbolTable) == null && te.getContainedAttributes() == null) { if(!SchemaUtils.isSimpleTypeWithUnion(te.getNode())) { if (base.isSimpleType()) { te.setSimpleType(true); te.setName(base.getName()); te.setRefType(base); if (base.isBaseType()) { te.setBaseType(true); te.setName(base.getName()); te.setRefType(base); if (!te.isSimpleType()) break; if (tEntry.getName() == null) { boolean processed = false; // true if the java name is already determined
QName qname = type.getQName(); + "\");"); pw.println(" cachedSerQNames.add(qName);"); pw.println(" cls = " + type.getName() + ".class;"); pw.println(" cachedSerClasses.add(cls);"); if (type.getName().endsWith("[]")) { if (SchemaUtils.isListWithItemType(type.getNode())) { pw.println(" cachedSerFactories.add(simplelistsf);"); pw.println(" cachedDeserFactories.add(simplelistdf);"); if (type.getComponentType() != null) { QName ct = type.getComponentType(); QName name = type.getItemQName(); pw.println(" qName = new javax.xml.namespace.QName(\"" + ct.getNamespaceURI() + "\", \"" + ct.getLocalPart() } else if ((type.getNode() != null) && (Utils.getEnumerationBaseAndValues( type.getNode(), symbolTable) != null)) { pw.println(" cachedSerFactories.add(enumsf);"); pw.println(" cachedDeserFactories.add(enumdf);"); } else if (type.isSimpleType()) { pw.println(" cachedSerFactories.add(org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(" + "org.apache.axis.encoding.ser.SimpleSerializerFactory.class, cls, qName));"); pw.println(" cachedDeserFactories.add(org.apache.axis.encoding.ser.BaseDeserializerFactory.createFactory(" + "org.apache.axis.encoding.ser.SimpleDeserializerFactory.class, cls, qName));"); } else if (type.getBaseType() != null) {
te = te.getRefType(); faultXmlType = te.getQName(); if ((te.getBaseType() != null) || te.isSimpleType() || ((te.getDimensions().length() > 0) && (te.getRefType().getBaseType() != null))) { Boolean isComplexFault = (Boolean) te.getDynamicVar( JavaGeneratorFactory.COMPLEX_TYPE_FAULT); te.setDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT, Boolean.TRUE); te.setDynamicVar( JavaGeneratorFactory.COMPLEX_TYPE_FAULT, Boolean.TRUE); derivedTE.setDynamicVar( JavaGeneratorFactory.COMPLEX_TYPE_FAULT, Boolean.TRUE); SchemaUtils.getComplexElementExtensionBase(te.getNode(), symbolTable); base.setDynamicVar( JavaGeneratorFactory.COMPLEX_TYPE_FAULT, Boolean.TRUE);
if (type.isSimpleType()) { return; if (parent.isSimpleType()) return; SchemaUtils.getComplexElementExtensionBase(parent.getNode(), emitter.getSymbolTable()); + Utils.xmlNameToJava(te.getQName().getLocalPart()) + "_"; Vector attributes = te.getContainedAttributes(); if (attributes != null) { for (int j = 0; j < attributes.size(); j += 1) { String typeName = attr.getType().getName(); Vector elements = te.getContainedElements(); paramTypes.add(processTypeName(elem,elem.getType().getName())); String name = elem.getName() == null ? ("param" + i) : elem.getName(); paramNames.add(JavaUtils.getUniqueValue(
if ((entry.isReferenced() && !literal) || (entry.isOnlyLiteralReferenced() && literal)) { return; if (!entry.isReferenced() && literal) { entry.setOnlyLiteralReference(true); else if (entry.isOnlyLiteralReferenced() && !literal) { entry.setOnlyLiteralReference(false); Node node = entry.getNode(); entry.setIsReferenced(true); SchemaUtils.getElementAnonQName(entry.getNode()); HashSet nestedTypes = entry.getNestedTypes(this, true); Iterator it = nestedTypes.iterator(); TypeEntry refType = entry.getRefType(); && nestedType.isOnlyLiteralReferenced()) { nestedType.setOnlyLiteralReference(false); if (!nestedType.isReferenced()) {
if (SchemaUtils.isMixed(parent.getNode())) { parentIsMixed = true; Vector hisElements = parent.getContainedElements(); for (int i = 0; hisElements != null && i < hisElements.size(); i++) { ElementDecl elem = (ElementDecl) hisElements.get(i); SchemaUtils.getComplexElementExtensionBase(parent.getNode(), emitter.getSymbolTable()); String typeName = elem.getType().getName(); String variableName = null; if (type.isSimpleType() && (variableName.endsWith("Value") || variableName.equals("_value"))) { elem.getType().getNode(), emitter.getSymbolTable())) { enumerationTypes.add(typeName); if (enableMemberFields && SchemaUtils.isMixed(type.getNode())) { isMixed = true; if (!isAny && !parentIsAny && !parentIsMixed) { String typeName = attr.getType().getName(); String variableName = getAttributeName(attr); if (type.isSimpleType() && (variableName.endsWith("Value")
SymbolTable symbolTable) { super(emitter, type, symbolTable); if (type.isReferenced() && !type.isOnlyLiteralReferenced() && type instanceof Type) { Node node = type.getNode(); if (!type.getName().endsWith("[]") && !isSimpleList) { Vector elements = type.getContainedElements(); Vector attributes = type.getContainedAttributes(); Boolean isComplexFault = (Boolean) type.getDynamicVar( JavaGeneratorFactory.COMPLEX_TYPE_FAULT);
if (type instanceof CollectionType || type instanceof CollectionElement) { result = constructArrayType(type); result.setType(type.getRefType().getQName().getLocalPart()); } else if (type instanceof DefinedType || type instanceof DefinedElement) { if (type.getComponentType() == null) { if (type instanceof DefinedElement) { if (type.isBaseType()) { result = constructBaseType((DefinedElement) type); } else { if (type.isSimpleType()) { result = constructForSimpleType(type); } else { if (type.getQName().getLocalPart().equals("Map")) {
node = typeEntry.getNode(); node = typeEntry.getNode(); if (typeEntry.getContainedAttributes() != null) { typeEntry.setOnlyLiteralReference(false); wrapped = false; vTypes = typeEntry.getContainedElements();
anonType.setName(entry.getName()); anonTypes.add(anonType); && (type.getBaseType() == null) && sameJavaClass(entry.getName(), type.getName())) { v.add(type); for (int j = 0; j < elementIndex.size(); j++) { TypeEntry te = (TypeEntry) elements.get(j); TypeEntry ref = te.getRefType(); if (ref != null && entry.getQName().equals(ref.getQName())) { te.setName(entry.getName()); if ((isComplexTypeFaultMsg != null) && (isComplexTypeFaultMsg.booleanValue())) { QName exceptionDataType = (QName)messageEntry.getDynamicVar(EXCEPTION_DATA_TYPE); if (((TypeEntry)entry).getQName().equals(exceptionDataType)) { String className = (String)messageEntry.getDynamicVar(EXCEPTION_CLASS_NAME); messageEntry.setDynamicVar(EXCEPTION_CLASS_NAME, className + EXCEPTION_SUFFIX);
/** * getBeanWriter * * @param emitter * @param type * @param base * @return */ protected JavaWriter getBeanWriter(Emitter emitter, TypeEntry type, TypeEntry base) { // CONTAINED_ELEM_AND_ATTR Vector elements = type.getContainedElements(); Vector attributes = type.getContainedAttributes(); // If this complexType is referenced in a // fault context, emit a bean-like exception // class Boolean isComplexFault = (Boolean) type.getDynamicVar( JavaGeneratorFactory.COMPLEX_TYPE_FAULT); if ((isComplexFault != null) && isComplexFault.booleanValue()) { return new JavaBeanFaultWriter(emitter, type, elements, base, attributes, getBeanHelperWriter(emitter, type, elements, base, attributes, true)); } return new JavaBeanWriter(emitter, type, elements, base, attributes, getBeanHelperWriter(emitter, type, elements, base, attributes, false)); }
JavaWriter helper) { super(emitter, type.getName(), "complexType"); this.helper = (JavaBeanHelperWriter) helper; if (type.isSimpleType()) { enableSimpleConstructors = true; enableToString = true; type.getNode(), emitter.getSymbolTable())) { enableMemberFields = false; enableGetters = false;
|| (type instanceof CollectionElement)); if ((type.getNode() != null) && !Utils.isXsNode(type.getNode(), "attributeGroup") && !Utils.isXsNode(type.getNode(), "group") && type.isReferenced() && isType && (type.getBaseType() == null)) { Generator gen = genFactory.getGenerator(type, symbolTable); || (type instanceof CollectionElement)); if ((type.getNode() != null) && !Utils.isXsNode(type.getNode(), "attributeGroup") && !Utils.isXsNode(type.getNode(), "group") && type.isReferenced() && isType && (type.getBaseType() == null)) { Generator gen = genFactory.getGenerator(type, symbolTable);
/** * Returns a "wrapper" type for the given TypeEntry. * * @param type * @return the name of a java wrapper class for the type, or the type's * name if it's not a primitive. */ public static String getWrapperType(TypeEntry type) { String dims = type.getDimensions(); if (!dims.equals("")) { TypeEntry te = type.getRefType(); if (te != null && !te.getDimensions().equals("")) { return getWrapperType(te) + dims; } if (te instanceof BaseType || te instanceof DefinedElement && te.getRefType() instanceof BaseType) { return getWrapperType(te) + dims; } } return getWrapperType(type.getName()); }
/** * Return a string with "var" wrapped as an Object type if needed * * @param type * @param var * @return */ public static String wrapPrimitiveType(TypeEntry type, String var) { String objType = (type == null) ? null : (String) TYPES.get(type.getName()); if (objType != null) { return "new " + objType + "(" + var + ")"; } else if ((type != null) && type.getName().equals("byte[]") && type.getQName().getLocalPart().equals("hexBinary")) { // Need to wrap byte[] in special HexBinary object to get the correct serialization return "new org.apache.axis.types.HexBinary(" + var + ")"; } else { return var; } } // wrapPrimitiveType
/** * Returns the appropriate implements text * * @return " implements <classes> " */ protected String getImplementsText() { // See if this class extends another class String implementsText = " implements java.io.Serializable"; if (type.isSimpleType() && (isUnion() || extendType == null || extendType.isBaseType())) { implementsText += ", org.apache.axis.encoding.SimpleType"; } if (isAny) { implementsText += ", org.apache.axis.encoding.AnyContentType"; } if (isMixed) { implementsText += ", org.apache.axis.encoding.MixedContentType"; } implementsText += " "; return implementsText; }