@Override public boolean equals(Object object) { if (this == object) { return true; } if (object instanceof Substitution) { Substitution substitution = (Substitution) object; return substitution.getKey().equals(this.getKey()) && substitution.getValue().equals(this.getValue()); } return false; }
@Override protected String computeKey() { Fingerprint f = new Fingerprint(); f.addString(GUID); f.addString(String.valueOf(makeExecutable)); f.addString(template.getKey()); f.addInt(substitutions.size()); for (Substitution entry : substitutions) { f.addString(entry.getKey()); f.addString(entry.getValue()); } return f.hexDigestAndReset(); }
/** * Expands the template by applying all substitutions. * * @param template * @return the expanded text. */ private String expandTemplate(String template) { for (Substitution entry : substitutions) { template = StringUtilities.replaceAllLiteral(template, entry.getKey(), entry.getValue()); } return template; }