Esempio n. 1
0
  protected Object resolveObject(Object o) {
    if (!enableReplace) {
      return o;
    }
    String s = "";
    if (reporter.should_report(reporter.serialize, 2)) {
      try {
        s = o.toString();
      } catch (NullPointerException e) {
        s = "<NullPointerException thrown>";
      }
    }

    if (!enableReplace) {
      return o;
    } else if (o instanceof Internable) {
      if (reporter.should_report(Reporter.serialize, 2)) {
        reporter.report(2, "- Interning " + s + " : " + o.getClass());
      }
      return ((Internable) o).intern();
    } else if (o instanceof Goal) {
      return ((Goal) o).intern(ts.extensionInfo().scheduler());
    } else {
      if (reporter.should_report(Reporter.serialize, 2)) {
        reporter.report(2, "- " + s + " : " + o.getClass());
      }

      return o;
    }
  }
Esempio n. 2
0
  public TypeInputStream(InputStream in, TypeSystem ts, Map<Object, Object> cache)
      throws IOException {
    super(in);

    enableResolveObject(true);

    this.ts = ts;
    this.reporter = ts.extensionInfo().getOptions().reporter;
    this.cache = cache;
    this.failed = false;
    this.enableReplace = true;
    this.placeHoldersUsed = CollectionFactory.newHashSet();
  }