Exemple #1
0
  /** Build getter and setter for a variable ... */
  protected void addAccessors(MibNode node, String syntax, String var) throws IOException {

    // Get the object definition associated to the node
    //
    ASTObjectTypeDefinition definition = node.getObjectType();
    String description = definition.getDefinition().getDescription();

    addGetter(this.context, node, description, syntax, var, accessors);

    // If the variable is read-write, add a setter and a checker ...
    //
    int access = definition.getDefinition().getAccess();
    if ((access == ParserConstants.RW)
        || (access == ParserConstants.WO)
        || (access == ParserConstants.RC)) {
      addSetter(this.context, node, description, syntax, var, accessors);
      addChecker(this.context, node, description, syntax, var, accessors);
    }
  }
Exemple #2
0
  protected void addCacheVar(MibNode node, String syntax, long fixed, String init, String var)
      throws IOException {
    // Put some comments ...
    //
    var_list.append(
        Def.TAB
            + "/**\n"
            + Def.TAB
            + " * "
            + MessageHandler.getMessage("generate.mbean.comment.varUse", var)
            + "\n"
            + Def.TAB
            + " * "
            + MessageHandler.getMessage("generate.mbean.comment.varOid", node.getOid())
            + "\n"
            + Def.TAB);
    if (fixed != -1) {
      var_list.append(
          " * "
              + MessageHandler.getMessage("generate.mbean.comment.varFix", String.valueOf(fixed))
              + "\n"
              + Def.TAB);
    }

    // Shall we put the description in the generated code ?
    // if yes call the formatDescription method ...
    // The answer is yes if requested !
    if (mib.isDescriptionOn()) {
      // Get the object definition associated to the node
      //
      ASTObjectTypeDefinition definition = node.getObjectType();
      String description = definition.getDefinition().getDescription();
      var_list.append(formatDescription(description));
    }
    var_list.append(" */\n");

    if (init == null) init = "";

    // Declare the variable
    //
    var_list.append(Def.TAB + Def.PROTECTED + syntax + var + init + Def.SEMICOLON + "\n");
  }