Ejemplo n.º 1
0
  public String generate() {
    final StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append(TEXT_1);
    stringBuffer.append(TEXT_2);
    stringBuffer.append(new java.util.Date());
    stringBuffer.append(TEXT_3);
    stringBuffer.append(System.getProperty("user.name"));
    stringBuffer.append(TEXT_4);
    stringBuffer.append(JavaCore.getModelPackage(_model));
    stringBuffer.append(TEXT_5);
    stringBuffer.append(JavaCore.getModelClassName(_model));
    stringBuffer.append(TEXT_6);
    stringBuffer.append(JavaCore.getModelClassName(_model));
    stringBuffer.append(TEXT_7);

    Class javaClass = PrimitivesDomain.getJavaType(_model.getType());
    if (javaClass == null) {
      throw new RuntimeException("Invalid Property Type (" + _model.getType() + ") for " + _model);
    }

    Iterator it = _model.getValues().iterator();
    while (it.hasNext()) {
      MdfEnumValue nv = (MdfEnumValue) it.next();
      stringBuffer.append(TEXT_8);
      stringBuffer.append(javaClass.getName());
      stringBuffer.append(TEXT_9);
      stringBuffer.append(nv.getName());
      stringBuffer.append(TEXT_10);
    }
    stringBuffer.append(TEXT_11);

    Iterator props = _model.getValues().iterator();

    while (props.hasNext()) {
      MdfEnumValue ev = (MdfEnumValue) props.next();
      String initCode = MdfGenerationUtil.getEnumValueInitCode(ev);

      if (initCode != null) {
        stringBuffer.append(TEXT_12);
        stringBuffer.append(ev.getName());
        stringBuffer.append(TEXT_13);
        stringBuffer.append(initCode);
        stringBuffer.append(TEXT_14);
      }
    }
    stringBuffer.append(TEXT_15);
    return stringBuffer.toString();
  }
Ejemplo n.º 2
0
 public String getClassName() {
   return JavaCore.getQualifiedModelClassName(_model);
 }