Package org.dmd.dmc.util

Examples of org.dmd.dmc.util.DmcUncheckedObject


      out.write("\n");
    }
  }

  private void dumpDMWClasses(String dmwdir) throws ResultException {
    DmcUncheckedObject go;
    DmcUncheckedObject attrObj;
    NamedStringArray must;
    NamedStringArray may;
    ArrayList<String> atlist;
    String currAttr;
    String cn;
    String classType;
    String baseClass;
    String derivedFrom;
    String isNamedBy;

    for (int i = 0; i < origOrderClasses.size(); i++) {
      go = (DmcUncheckedObject) classDefs.get(origOrderClasses.get(i));

      derivedFrom = go.getSV("derivedFrom");
      isNamedBy = go.getSV("isNamedBy");

      // System.out.println("*** Formatting class definition for: " +
      // origOrderClasses.get(i));

      if ((cn = go.getSV("name")) == null) {
        System.out.println("Couldn't get name for class definition:\n"
            + go);
      } else {
        try {

          // BufferedWriter out = new BufferedWriter(new
          // FileWriter(dmwdir + File.separator + cn + "DMW.java"));
          BufferedWriter out = FileUpdateManager.instance()
              .getWriter(dmwdir, cn + "DMW.java");

          out.write(LGPL.toString());
          out.write("package org.dmd.dms.generated.dmw;\n\n");

          out.write("import java.util.*;\n\n");

          out.write("import org.dmd.dmc.types.*;\n");
          out.write("import org.dmd.dmc.*;\n");
          // if (derivedFrom == null){
          out.write("import org.dmd.dmw.*;\n");
          // }

          if (cn.equals("EnumDefinition")) {
            out.write("import org.dmd.dms.types.*;\n");
          }
          out.write("import org.dmd.dms.generated.dmo.*;\n");
          out.write("import org.dmd.dms.generated.enums.*;\n");
          out.write("import org.dmd.dms.generated.types.*;\n");
          out.write("import org.dmd.util.exceptions.*;\n");
          out.write("import org.dmd.dms.*;\n");

          if (cn.equals("ActionTriggerInfo")) {
            // this is a complete friggin' hack!
            out.write("import org.dmd.dms.extended.ActionTriggerInfo;\n");
          }

          out.write("\n");

          out.write("/**\n");
          dumpCodeComment(go.getSV("description"), out, " * ");

          out.write(" * @author Auto Generated\n");
          out.write(" * Generated from: "
              + DebugInfo.getWhereWeAreNow() + "\n");
          out.write(" */\n");
          out.write("@SuppressWarnings(\"unused\")\n");

          // See if we're derived from anything. If not, just use
          // DmwWrapper as the base class
          // If we're named, use DmwNamedObjectWrapper.
          if (derivedFrom == null) {
            baseClass = "DmwWrapper";

            if (isNamedBy != null)
              baseClass = "DmwNamedObjectWrapper";
          } else {
            // Otherwise, we look up the derived from class and use
            // its javaClass
            // as the base class
            DmcUncheckedObject bc = classDefs.get(derivedFrom);

            if (bc == null) {
              ResultException ex = new ResultException();
              ex.addError("Unknown base class: " + derivedFrom
                  + " for class: " + cn);
              ex.result.lastResult().lineNumber(go.lineNumber);
              throw (ex);
            }
            baseClass = bc.getSV("javaClass");
          }

          classType = go.getSV("classType");

          if (classType.equals("ABSTRACT"))
View Full Code Here


      }
    }
  }

  private void dumpDMOClasses(String od) throws ResultException {
    DmcUncheckedObject go;
    DmcUncheckedObject attrObj;
    ArrayList<String> atlist;
    String currAttr;
    String cn;
    String baseClass;
    String derivedFrom;
    String isNamedBy;
    boolean isDmsDefinition = false;

    for (int i = 0; i < origOrderClasses.size(); i++) {
      go = (DmcUncheckedObject) classDefs.get(origOrderClasses.get(i));

      TreeSet<String> must = new TreeSet<String>();
      TreeSet<String> may = new TreeSet<String>();

      derivedFrom = go.getSV("derivedFrom");
      isNamedBy = go.getSV("isNamedBy");

      // System.out.println("*** Formatting DMO for: " +
      // origOrderClasses.get(i));

      if ((cn = go.getSV("name")) == null) {
        System.out.println("Couldn't get name for class definition:\n"
            + go);
      } else {
        try {

          // BufferedWriter out = new BufferedWriter(new FileWriter(od
          // + File.separator + cn + "DMO.java"));
          BufferedWriter out = FileUpdateManager.instance()
              .getWriter(od, cn + "DMO.java");

          out.write(LGPL.toString());
          out.write("package org.dmd.dms.generated.dmo;\n\n");

          ImportManager imports = new ImportManager();

          imports.addImport("java.io.Serializable",
              "Serializable marker interface");
          imports.addImport("java.util.*", "Attribute info support");

          // out.write("import java.io.Serializable;\n\n");
          // out.write("import java.util.*;\n\n");

          boolean needBasicTypes = getAllMustAndMay(go, must, may);

          // HACK HACK HACK
          if (!cn.equals("DmwWrapper")) {
            // Only include if the type of an attribute has a
            // primitive type specified
            if (needBasicTypes)
              imports.addImport("org.dmd.dmc.types.*",
                  "Basic type access");
            // out.write("import org.dmd.dmc.types.*;\n");
          }
          if (cn.endsWith("RuleData")) {
            // if (needBasicTypes)
            imports.addImport("org.dmd.dmc.types.*",
                "Basic type access");
          }

          imports.addImport("org.dmd.dmc.*", "Dark matter core");
          // imports.addImport("org.dmd.dms.generated.dmo.MetaVCAG",
          // "Old validation framework - obsolete");

          // out.write("import org.dmd.dmc.*;\n");
          // out.write("import org.dmd.dms.generated.dmo.MetaVCAG;\n");

          if (cn.equals("EnumDefinition")) {
            imports.addImport("org.dmd.dms.types.*", "Enum support");
            // out.write("import org.dmd.dms.types.*;\n");
          }

          imports.addImport("org.dmd.dms.generated.types.*",
              "Generated type access");

          // out.write("import org.dmd.dms.generated.types.*;\n");

          if (hasAnyEnumAttributes(go)) {
            imports.addImport("org.dmd.dms.generated.enums.*",
                "Has enum attributes");
            // out.write("import org.dmd.dms.generated.enums.*;\n");
          }

          out.write(imports.getFormattedImports() + "\n");

          out.write("\n");

          out.write("/**\n");

          dumpCodeComment(go.getSV("description"), out, " * ");

          out.write(" * @author Auto Generated\n");
          out.write(" * Generated from: "
              + DebugInfo.getWhereWeAreNow() + "\n");
          out.write(" */\n");

          out.write("@SuppressWarnings(\"serial\")\n");

          if (derivedFrom == null) {
            if (isNamedBy == null) {
              baseClass = "DmcObject implements Serializable";
            } else {
              baseClass = "DmcObject implements DmcNamedObjectIF, Serializable";
            }
          } else {
            // Otherwise, we look up the derived from class and use
            // its javaClass
            // as the base class
            DmcUncheckedObject bc = classDefs.get(derivedFrom);

            if (bc == null) {
              ResultException ex = new ResultException();
              ex.addError("Unknown base class: " + derivedFrom
                  + " for class: " + cn);
              ex.result.lastResult().lineNumber(go.lineNumber);
              throw (ex);
            }

            baseClass = bc.getSV("dmoImport")
                + " implements Serializable ";
          }

          out.write("public class " + cn + "DMO extends " + baseClass
              + " {\n\n");
View Full Code Here

      TreeSet<String> must, TreeSet<String> may) throws ResultException {
    String derivedFrom = uco.getSV("derivedFrom");
    boolean needPrimitiveTypeImport = false;

    if (derivedFrom != null) {
      DmcUncheckedObject base = classDefs.get(derivedFrom);
      getAllMustAndMay(base, must, may);
    }

    NamedStringArray mustAttr = uco.get("must");
    if (mustAttr != null) {
      for (String name : mustAttr) {
        must.add(name);

        DmcUncheckedObject attrDef = attributeDefs.get(name);
        String attrType = attrDef.getSV("type");
        DmcUncheckedObject typeDef = typeDefs.get(attrType);

        // If this is an object reference, the type won't be in types -
        // skip it
        if (typeDef == null)
          continue;

        String primitiveType = typeDef.getSV("primitiveType");

        if (primitiveType != null) {
          if (primitiveType.startsWith("org.dmd.dmc.types"))
            needPrimitiveTypeImport = true;
        }
      }
    }

    NamedStringArray mayAttr = uco.get("may");
    if (mayAttr != null) {
      for (String name : mayAttr) {
        may.add(name);

        DmcUncheckedObject attrDef = attributeDefs.get(name);
        String attrType = attrDef.getSV("type");
        DmcUncheckedObject typeDef = typeDefs.get(attrType);

        // If this is an object reference, the type won't be in types -
        // skip it
        if (typeDef == null)
          continue;

        String primitiveType = typeDef.getSV("primitiveType");

        if (primitiveType != null) {
          if (primitiveType.startsWith("org.dmd.dmc.types"))
            needPrimitiveTypeImport = true;
        }
View Full Code Here

   * @throws IOException
   * @throws ResultException
   */
  void dumpSVAccessFunction(BufferedWriter out, String attrname, boolean DMO,
      String dmoClass) throws IOException, ResultException {
    DmcUncheckedObject attributeDef = attributeDefs.get(attrname);
    String typeName = attributeDef.getSV("type");
    boolean isObjREF = false;

    if (typeName == null) {
      ResultException ex = new ResultException();
      ex.addError("No type specified for attribute: " + attrname);
      ex.result.lastResult().lineNumber(attributeDef.lineNumber);
      throw (ex);
    }

    DmcUncheckedObject typeDef = typeDefs.get(typeName);

    // If we can't find this as a type def, look for it as an enum def
    if (typeDef == null) {
      typeDef = enumDefs.get(typeName);
    }

    // Or, look for it as a class - it may be a reference
    if (typeDef == null) {
      typeDef = classDefs.get(typeName);
      if (typeDef != null)
        ;
      isObjREF = true;
    }

    if (typeDef == null) {
      ResultException ex = new ResultException();
      ex.addError("Unknown type: " + typeName + " for attribute: "
          + attrname);
      ex.result.lastResult().lineNumber(attributeDef.lineNumber);
      throw (ex);
    }

    String typeClassName = typeDef.getSV("typeClassName");
    String attrType = "DmcType" + typeName;

    if (isObjREF)
      attrType = attrType + "REF";

    if (typeClassName != null) {
      int lastPeriod = typeClassName.lastIndexOf('.');
      if (lastPeriod != -1) {
        attrType = typeClassName.substring(lastPeriod + 1);
      }
    }

    attrType = attrType + "SV";

    StringBuffer functionName = new StringBuffer();
    functionName.append(attrname);
    functionName
        .setCharAt(0, Character.toUpperCase(functionName.charAt(0)));

    if (DMO) {
      out.write("    // " + DebugInfo.getWhereWeAreNow() + "\n");
      if (isObjREF)
        out.write("    public " + typeName + "REF get" + functionName
            + "(){\n");
      else
        out.write("    public " + typeName + " get" + functionName
            + "(){\n");

      out.write("        " + attrType + " attr = (" + attrType
          + ") get(MetaDMSAG.__" + attrname + ");\n");
      out.write("        if (attr == null)\n");

      String nullReturnValue = typeDef.getSV("nullReturnValue");

      String attrNulReturnValue = attributeDef.getSV("nullReturnValue");

      if (attrNulReturnValue != null)
        nullReturnValue = attrNulReturnValue;
View Full Code Here

    }
  }

  void dumpMVAccessFunction(BufferedWriter out, String attrname, boolean DMO,
      String dmoClass) throws IOException, ResultException {
    DmcUncheckedObject attributeDef = attributeDefs.get(attrname);
    String typeName = attributeDef.getSV("type");
    boolean isObjREF = false;

    if (typeName == null) {
      ResultException ex = new ResultException();
      ex.addError("No type specified for attribute: " + attrname);
      ex.result.lastResult().lineNumber(attributeDef.lineNumber);
      throw (ex);
    }

    DmcUncheckedObject typeDef = typeDefs.get(typeName);

    // If we can't find this as a type def, look for it as an enum def
    if (typeDef == null) {
      typeDef = enumDefs.get(typeName);
    }
View Full Code Here

   * @param od
   * @throws IOException
   * @throws ResultException
   */
  private void dumpDmcTypes(String od) throws IOException, ResultException {
    DmcUncheckedObject go;
    String cn;

    for (int i = 0; i < origOrderClasses.size(); i++) {
      go = (DmcUncheckedObject) classDefs.get(origOrderClasses.get(i));

      // System.out.prdumpEnumClintln("*** Formatting DmcAttribute for: "
      // + origOrderClasses.get(i));

      if ((cn = go.getSV("name")) == null) {
        System.out.println("Couldn't get name for class definition:\n"
            + go);
      } else {
        // We only generate the type ref for objects that are named -
        // otherwise,
        // we just dump the DmcType for the object
        if (go.getSV("isNamedBy") == null) {
          continue;
        }

        BufferedWriter out = null;

        // out = new BufferedWriter(new FileWriter(od + "/DmcType" + cn
        // + "REF.java"));
        out = FileUpdateManager.instance().getWriter(od,
            "DmcType" + cn + "REF.java");

        out.write(LGPL.toString());
        out.write("package org.dmd.dms.generated.types;\n\n");

        out.write("import java.io.Serializable;\n");
        out.write("import org.dmd.dmc.DmcAttributeInfo;\n");
        out.write("import org.dmd.dmc.DmcValueException;\n");
        out.write("import org.dmd.dmc.DmcObjectName;\n");
        out.write("import org.dmd.dmc.DmcOutputStreamIF;\n");
        out.write("import org.dmd.dmc.DmcInputStreamIF;\n");
        out.write("import org.dmd.dmc.types.DmcTypeNamedObjectREF;\n");
        out.write("import org.dmd.dms.generated.dmo.*;\n");
        out.write("import org.dmd.dmc.types.StringName;\n");

        out.write("/**\n * The DmcType" + cn + "REF class.\n");
        out.write(" * This code was auto-generated by the createmeta utility and shouldn't be alterred\n");
        out.write(" * manually.\n");
        out.write(" * Generated from: " + DebugInfo.getWhereWeAreNow()
            + "\n");
        out.write(" */\n");

        out.write("@SuppressWarnings(\"serial\")\n");
        out.write("abstract public class DmcType" + cn
            + "REF extends DmcTypeNamedObjectREF<" + cn
            + "REF, StringName> implements Serializable {\n\n");

        out.write("    /**\n");
        out.write("     * Default constructor.\n");
        out.write("     */\n");
        out.write("    public DmcType" + cn + "REF(){\n");
        out.write("    }\n\n");

        out.write("    /**\n");
        out.write("     * Default constructor.\n");
        out.write("     */\n");
        out.write("    public DmcType" + cn
            + "REF(DmcAttributeInfo ai){\n");
        out.write("        super(ai);\n");
        out.write("    }\n\n");

        out.write("    /**\n");
        out.write("     * Checks that we have a " + cn + "REF or " + cn
            + "DMO.\n");
        out.write("     */\n");
        out.write("    public "
            + cn
            + "REF typeCheck(Object value) throws DmcValueException {\n");
        out.write("        " + cn + "REF rc = null;\n");
        out.write("        if (value instanceof " + cn + "REF)\n");
        out.write("            rc = (" + cn + "REF)value;\n");
        out.write("        else if (value instanceof " + cn + "DMO)\n");
        out.write("            rc = new " + cn + "REF((" + cn
            + "DMO)value);\n");
        out.write("        else if (value instanceof DmcObjectName){\n");
        out.write("            rc = new " + cn + "REF();\n");
        out.write("            rc.setName((DmcObjectName)value);\n");
        out.write("        }\n");
        out.write("        else if (value instanceof String){\n");
        out.write("            rc = new " + cn + "REF();\n");
        out.write("            rc.setName(new StringName((String)value));\n");
        out.write("        }\n");
        out.write("        else\n");
        out.write("            throw(new DmcValueException(\"Object of class:\" + value.getClass().getName() + \" passed where a "
            + cn + "REF/DMO or DmcObjectName expected.\"));\n");
        out.write("        return(rc);\n");
        out.write("    }\n\n");

        out.write("    @Override\n");
        out.write("    protected " + cn + "REF " + "getNewHelper(){\n");
        out.write("        return( new " + cn + "REF());\n");
        out.write("    }\n\n");

        out.write("    @Override\n");
        out.write("    protected StringName " + "getNewName(){\n");
        out.write("        return( new StringName());\n");
        out.write("    }\n\n");

        out.write("    @Override\n");
        out.write("    protected String getDMOClassName(){\n");
        out.write("        return( " + cn + "DMO.class.getName());\n");
        out.write("    }\n\n");

        out.write("    @Override\n");
        out.write("    protected boolean isDMO(Object value){\n");
        out.write("        if (value instanceof " + cn + "DMO)\n");
        out.write("            return(true);\n");
        out.write("        return(false);\n");
        out.write("    }\n\n");

        out.write("    /**\n");
        out.write("     * Returns a clone of a value associated with this type.\n");
        out.write("     */\n");
        out.write("    @Override\n");
        out.write("    public " + cn + "REF cloneValue(" + cn
            + "REF val){\n");
        out.write("        " + cn + "REF rc = new " + cn
            + "REF(val);\n");
        out.write("        return(rc);\n");
        out.write("    }\n\n");

        out.write("    @Override\n");
        out.write("    public void serializeValue(DmcOutputStreamIF dos, "
            + cn + "REF value) throws Exception {\n");
        out.write("        value.serializeIt(dos);\n");
        out.write("    }\n\n");

        out.write("    @Override\n");
        out.write("    public "
            + cn
            + "REF deserializeValue(DmcInputStreamIF dis) throws Exception {\n");
        out.write("        " + cn + "REF rc = new " + cn + "REF();\n");
        out.write("        rc.deserializeIt(dis);\n");
        out.write("        return(rc);\n");
        out.write("    }\n\n");

        out.write("}\n");

        out.close();

        // Generate the reference container

        String nameType = "StringName";
        if (cn.equals("RuleData"))
          nameType = "RuleName";

        // out = new BufferedWriter(new FileWriter(od + File.separator +
        // cn + "REF.java"));
        out = FileUpdateManager.instance().getWriter(od,
            cn + "REF.java");

        out.write(LGPL.toString());
        out.write("package org.dmd.dms.generated.types;\n\n");

        out.write("import java.io.Serializable;\n");
        out.write("import org.dmd.dmc.DmcAttribute;\n");
        // out.write("import org.dmd.dmc.DmcAttributeInfo;\n");
        out.write("import org.dmd.dmc.DmcValueException;\n");
        out.write("import org.dmd.dmc.DmcObjectName;\n");
        out.write("import org.dmd.dmc.DmcOutputStreamIF;\n");
        out.write("import org.dmd.dmc.DmcInputStreamIF;\n");
        out.write("import org.dmd.dmc.DmcNamedObjectNontransportableREF;\n");
        out.write("import org.dmd.dmc.types.DmcType" + nameType + ";\n");
        out.write("import org.dmd.dms.generated.dmo.*;\n");
        // out.write("import org.dmd.dms.generated.enums.ValueTypeEnum;\n");
        // out.write("import org.dmd.dms.generated.enums.DataTypeEnum;\n");
        if (cn.equals("ClassDefinition")) {
          out.write("import org.dmd.dmc.DmcOmni;\n");
          out.write("import org.dmd.dmc.DmcClassInfo;\n");
        }

        out.write("/**\n * The " + cn + "REF class.\n");
        out.write(" * This code was auto-generated by the createmeta utility and shouldn't be alterred\n");
        out.write(" * manually.\n");
        out.write(" * Generated from: " + DebugInfo.getWhereWeAreNow()
            + "\n");
        out.write(" */\n");

        out.write("@SuppressWarnings(\"serial\")\n");
        out.write("public class " + cn
            + "REF extends DmcNamedObjectNontransportableREF<" + cn
            + "DMO> implements Serializable {\n\n");

        // writeAttributeInfo(out, "name", "2", "StringName", null,
        // "false");
        // out.write("\n");

        if (cn.equals("ClassDefinition")) {
          out.write("    transient DmcClassInfo info;\n\n");
        }

        out.write("    DmcType" + nameType + " myName;\n\n");

        out.write("    /**\n");
        out.write("     * Default constructor.\n");
        out.write("     */\n");
        out.write("    public " + cn + "REF(){\n");
        out.write("        myName = null;\n");
        out.write("    }\n\n");

        out.write("    /**\n");
        out.write("     * Copy constructor.\n");
        out.write("     */\n");
        out.write("    public " + cn + "REF(" + cn + "REF original){\n");
        out.write("        myName = original.myName;\n");
        out.write("        object = original.object;\n");
        out.write("    }\n\n");

        out.write("    /**\n");
        out.write("     * Wrapper constructor.\n");
        out.write("     */\n");
        out.write("    public " + cn + "REF(" + cn + "DMO dmo){\n");
        out.write("        myName = (DmcType" + nameType + ") dmo.getObjectNameAttribute();\n");
        out.write("        object = dmo;\n");
        out.write("    }\n\n");

        out.write("    /**\n");
        out.write("     * Sets our object.\n");
        out.write("     */\n");
        out.write("    @Override\n");
        out.write("    public void setObject(" + cn + "DMO o){\n");
        out.write("        object = o;\n");
        out.write("    }\n\n");

        out.write("    /**\n");
        out.write("     * Clones this reference.\n");
        out.write("     */\n");

        out.write("    public " + cn + "REF cloneMe(){\n");
        out.write("        " + cn + "REF rc = new " + cn + "REF();\n");
        out.write("        rc.myName = myName;\n");
        out.write("        rc.object = object;\n");
        out.write("        return(rc);\n");
        out.write("    }\n\n");

        out.write("    @Override\n");
        out.write("    public void setName(DmcObjectName n) throws DmcValueException {\n");
        out.write("        if (myName == null);\n");
        out.write("            myName = new  DmcType" + nameType
            + "SV(MetaDMSAG.__name);\n");
        out.write("        myName.set(n);\n");
        out.write("    }\n\n");

        out.write("    @Override\n");
        out.write("    public DmcAttribute<?> getObjectNameAttribute(){\n");
        out.write("         return(myName);\n");
        out.write("    }\n\n");

        out.write("    @Override\n");
        out.write("    public DmcObjectName getObjectName(){\n");
        out.write("         return(myName.getSV());\n");
        out.write("    }\n\n");

        out.write("    public void serializeIt(DmcOutputStreamIF dos) throws Exception {\n");
        out.write("         myName.serializeIt(dos);\n");
        out.write("         // the object goes nowhere\n");
        out.write("    }\n\n");

        out.write("    public void deserializeIt(DmcInputStreamIF dis) throws Exception {\n");
        out.write("        myName = (DmcType" + nameType
            + ") dis.getAttributeInstance();\n");
        out.write("        myName.deserializeIt(dis);\n");
        out.write("    }\n\n");

        if (cn.equals("ClassDefinition")) {
          out.write("    public DmcClassInfo getClassInfo() {\n");
          out.write("        if (info == null){\n");
          out.write("            if (myName == null)\n");
          out.write("                throw(new IllegalStateException(\"No name set for a ClassDefinitionREF\"));\n");
          out.write("            info = DmcOmni.instance().getClassInfo(myName.getSV().getNameString());\n");
          out.write("            if (info == null)\n");
          out.write("                throw(new IllegalStateException(\"Unable to retrive class info for class: \" + myName.getSV().getNameString() + \" ensure that you have loaded the DmcOmni with the appropriate schemas.\"));\n");
          out.write("        }\n");
          out.write("        return(info);\n");
          out.write("    }\n\n");
        }

        out.write("}\n");

        out.close();
      }
    }

    for (int i = 0; i < origOrderEnums.size(); i++) {
      go = (DmcUncheckedObject) enumDefs.get(origOrderEnums.get(i));

      // System.out.println("*** Formatting mediator for: " +
      // origOrderEnums.get(i));

      if ((cn = go.getSV("name")) == null) {
        System.out.println("Couldn't get name for enum definition:\n"
            + go);
      } else {
        dumpDmcType(od, cn, true);
      }
View Full Code Here

    // Determine if we have any reference fields
    boolean hasRefs = false;
    ArrayList<String> refFields = new ArrayList<String>();
    for (Field field : fields) {
      DmcUncheckedObject type = typeDefs.get(field.type);
      if (type == null) {
        type = enumDefs.get(field.type);
        if (type == null) {
          DebugInfo.debug("Unknown type in ComplexTypeDefinition: "
              + field.type);
          System.exit(1);
        }
      }
      String isRefType = type.getSV("isRefType");
      if (isRefType != null) {
        hasRefs = true;
        refFields.add(field.name);
      }
    }
View Full Code Here

    TreeMap<String, String> uniqueImports = new TreeMap<String, String>();

    for (Field field : fields) {
      // DebugInfo.debug("field type = " + field.type);

      DmcUncheckedObject typeDef = typeDefs.get(field.type);

      if (typeDef == null) {
        typeDef = enumDefs.get(field.type);
        if (typeDef != null) {
          String imp = "org.dmd.dms.generated.enums." + field.type;
          uniqueImports.put(imp, imp);
        } else {
          typeDef = typeDefs.get(field.type + "REF");
          String primitiveType = typeDef.getSV("primitiveType");

          if (primitiveType != null)
            uniqueImports.put(primitiveType, primitiveType);
        }
      }
View Full Code Here

      int c2pos = field.indexOf(" ", c1pos + 1);
      String type = field.substring(0, c1pos).trim();
      String name = field.substring(c1pos + 1, c2pos).trim();
      String descr = field.substring(c2pos + 1).trim();

      DmcUncheckedObject typeDef = typeDefs.get(type);
      if (typeDef == null) {
        if (enumDefs.get(type) == null)
          type = type + "REF";
      }
View Full Code Here

        atlist.add(attrName);
    }

    // Write the attribute access functions
    for (String attrname : atlist) {
      DmcUncheckedObject attrdef = attributeDefs.get(attrname);
      if (attrdef == null) {
        ResultException ex = new ResultException();
        ex.addError("Unknown attribute: " + attrname);
        throw (ex);
      }
View Full Code Here

TOP

Related Classes of org.dmd.dmc.util.DmcUncheckedObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.