@Override
  protected boolean run(final Outline outline, final Options options) throws Exception {
    assert outline != null;
    assert options != null;

    for (ClassOutline type : outline.getClasses()) {
      addGenerated(type.implClass);
    }

    for (EnumOutline type : outline.getEnums()) {
      addGenerated(type.clazz);
    }

    return true;
  }
  public MPropertyOutline generate(
      MClassOutline classOutline,
      MModelInfo<NType, NClass> modelInfo,
      MPropertyInfo<NType, NClass> propertyInfo) {

    final FieldOutline fieldOutline = outline.getField(this.propertyInfo);

    final MPropertyAccessorFactory propertyAccessorFactory =
        new CMPropertyAccessorFactory(this.fieldAccessorFactory, fieldOutline);
    return new CMPropertyOutline(classOutline, propertyInfo, propertyAccessorFactory);
  }
示例#3
0
  @Override
  public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) throws SAXException {
    for (ClassOutline co : outline.getClasses()) {

      CPluginCustomization c = co.target.getCustomizations().find(uri.toString(), "keyId");
      CPluginCustomization d = co.target.getCustomizations().find(metaURI.toString(), "type");
      if (c == null) {
        continue;
      }

      Element keyed = c.element;
      NodeList keyList = keyed.getChildNodes();
      Key[] keys = new Key[keyList.getLength()];
      for (int j = 0; j < keyList.getLength(); j++) {
        keys[j] =
            new Key(
                keyList.item(j).getTextContent(),
                NameUtils.map(
                    keyList.item(j).getAttributes().getNamedItem("type").getTextContent(), true));
      }

      HashMap<String, Object> map = new HashMap<String, Object>();
      map.put("klassName", co.target.shortName);
      map.put("typeName", d.element.getAttribute("name"));
      map.put("keys", keys);

      String equals = SemanticXSDModelCompilerImpl.getTemplatedCode(equalsTempl, map);
      String hashKy = SemanticXSDModelCompilerImpl.getTemplatedCode(hashKyTempl, map);

      co.implClass.direct(equals);
      co.implClass.direct(hashKy);

      c.markAsAcknowledged();
    }

    return true;
  }