示例#1
0
  protected void generateComplexTypeClass(Types types, Schema schema, File dir) throws IOException {
    for (ComplexType complexType : schema.getComplexTypes()) {

      if (!typeMapper.isWellKnownType(
          complexType.getSchema().getTargetNamespace(), complexType.getName())) {
        generateClassFromComplexType(types, schema, complexType, dir);
      }
    }
  }
  public String xsiType() {
    if (complexType.getBase() == null) {
      return "";
    }

    StringBuilder sb = new StringBuilder();
    sb.append("__typeMapper.writeXsiType(__out, \"");
    sb.append(complexType.getSchema().getTargetNamespace());
    sb.append("\", \"");
    sb.append(complexType.getName());
    sb.append("\");");
    return sb.toString();
  }
  public String baseClass() {
    StringBuilder sb = new StringBuilder();

    if (complexType.getBase() == null) {
      if (complexType.isHeader()) {
        sb.append("extends com.sforce.ws.bind.SoapHeaderObject ");
      } else if (getClassName().endsWith("Fault")) {
        sb.append("extends com.sforce.ws.SoapFaultException ");
      }
      sb.append("implements com.sforce.ws.bind.XMLizable");
    } else {
      sb.append("extends ").append(localJavaType(complexType.getBase(), 1, false));
    }
    return sb.toString();
  }
  public String superToString() {
    if (!complexType.hasBaseClass()) {
      return "";
    }

    return "sb.append(super.toString());";
  }
  public String superWrite() {
    if (!complexType.hasBaseClass()) {
      return "";
    }

    return "super.writeFields(__out, __typeMapper);";
  }
  public String superLoad() {
    if (!complexType.hasBaseClass()) {
      return "";
    }

    return "super.loadFields(__in, __typeMapper);";
  }
 public ComplexTypeGenerator(
     Types types,
     Schema schema,
     ComplexType complexType,
     File tempDir,
     TypeMapper typeMapper,
     boolean laxMinOccursMode) {
   super(types, schema, complexType.getName(), tempDir, typeMapper);
   this.complexType = complexType;
   this.laxMinOccursMode = laxMinOccursMode;
 }
  public Iterator<Element> getElements() {
    Collection sequence = complexType.getContent();
    Iterator<Element> it;

    if (sequence == null) {
      it = Collections.<Element>emptyList().iterator();
    } else {
      it = sequence.getElements();
    }

    return it;
  }