示例#1
0
  /**
   * Parses a rule from the given column. Used by the Tree class when scanning a row for rules.
   *
   * @param column The column to parse
   * @return A valid TreeRule object if parsed successfully
   * @throws IllegalArgumentException if the column was empty
   * @throws JSONException if the object could not be serialized
   */
  public static TreeRule parseFromStorage(final KeyValue column) {
    if (column.value() == null) {
      throw new IllegalArgumentException("Tree rule column value was null");
    }

    final TreeRule rule = JSON.parseToObject(column.value(), TreeRule.class);
    rule.initializeChangedMap();
    return rule;
  }
示例#2
0
 /**
  * Copy constructor that creates a completely independent copy of the original object
  *
  * @param original The original object to copy from
  * @throws PatternSyntaxException if the regex is invalid
  */
 public TreeRule(final TreeRule original) {
   custom_field = original.custom_field;
   description = original.description;
   display_format = original.display_format;
   field = original.field;
   level = original.level;
   notes = original.notes;
   order = original.order;
   regex_group_idx = original.regex_group_idx;
   separator = original.separator;
   tree_id = original.tree_id;
   type = original.type;
   setRegex(original.regex);
   initializeChangedMap();
 }
示例#3
0
 /**
  * Constructor initializes the tree ID
  *
  * @param tree_id The tree this rule belongs to
  */
 public TreeRule(final int tree_id) {
   this.tree_id = tree_id;
   initializeChangedMap();
 }
示例#4
0
 /** Default constructor necessary for de/serialization */
 public TreeRule() {
   initializeChangedMap();
 }