Ejemplo n.º 1
0
  // Generated from:
  // org.dmd.dms.meta.MetaComplexTypeFormatter.dumpComplexType(MetaComplexTypeFormatter.java:168)
  void initialize(String initialInput) throws DmcValueException {
    ArrayList<ParsedNameValuePair> nvp = ComplexTypeSplitter.parse(initialInput);

    if (nvp.size() < requiredParts)
      throw (new DmcValueException("Missing required values for complex type: Part"));

    type = DmcTypeTypeDefinitionREFSTATIC.instance.typeCheck(nvp.get(0).getValue());
    name = DmcTypeStringSTATIC.instance.typeCheck(nvp.get(1).getValue());
    description = DmcTypeStringSTATIC.instance.typeCheck(nvp.get(2).getValue());

    if (nvp.size() > requiredParts) {
      for (int i = 3; i < nvp.size(); i++) {
        if (nvp.get(i).getName() == null) {
          if (nvp.get(i).getValue() == null)
            throw (new DmcValueException(
                "Expecting a partname=\"some value\" in complex type: Part"));
          else
            throw (new DmcValueException(
                "Expecting a partname=\"" + nvp.get(i).getValue() + "\" in complex type: Part"));
        }
        if (nvp.get(i).getName().equals("quoted"))
          quoted = DmcTypeBooleanSTATIC.instance.typeCheck(nvp.get(i).getValue());
        else if (nvp.get(i).getName().equals("multivalued"))
          multivalued = DmcTypeBooleanSTATIC.instance.typeCheck(nvp.get(i).getValue());
        else if (nvp.get(i).getName().equals("weakref"))
          weakref = DmcTypeBooleanSTATIC.instance.typeCheck(nvp.get(i).getValue());
        else if (nvp.get(i).getName().equals("greedy"))
          greedy = DmcTypeBooleanSTATIC.instance.typeCheck(nvp.get(i).getValue());
        else {
          throw (new DmcValueException(
              "Unknown field for complex type Part: " + nvp.get(i).getName()));
        }
      }
    }
  }
Ejemplo n.º 2
0
  // Generated from:
  // org.dmd.dms.meta.MetaComplexTypeFormatter.dumpComplexType(MetaComplexTypeFormatter.java:168)
  void initialize(String initialInput) throws DmcValueException {
    ArrayList<ParsedNameValuePair> nvp = ComplexTypeSplitter.parse(initialInput, ':', 2);

    if (nvp.size() < requiredParts)
      throw (new DmcValueException("Missing required values for complex type: Example"));

    type = DmcTypeStringSTATIC.instance.typeCheck(nvp.get(0).getValue());
    title = DmcTypeStringSTATIC.instance.typeCheck(nvp.get(1).getValue());
    content = DmcTypeStringSTATIC.instance.typeCheck(nvp.get(2).getValue());
  }
  /**
   * Initialize content based on string form. Generated from:
   * org.dmd.dms.util.NewComplexTypeFormatter.dumpComplexType(NewComplexTypeFormatter.java:276)
   */
  void initialize(String initialInput) throws DmcValueException {
    ArrayList<ParsedNameValuePair> nvp = ComplexTypeSplitter.parse(initialInput);

    if (nvp.size() < requiredParts)
      throw (new DmcValueException(
          "Missing required values for complex type: DmtMultiValuedRequiredPartPrimitive\nValue: "
              + initialInput));

    if (nvp.size() >= requiredParts) {
      for (int i = 0; i < nvp.size(); i++) {
        if (valueV == null) valueV = new ArrayList<Integer>();
        valueV.add(DmcTypeIntegerSTATIC.instance.typeCheck(nvp.get(i).getValue()));
      }
    }
  }