private Builder setVal(@Nullable RuleKey ruleKey) { if (ruleKey != null) { if (logElms != null) { logElms.add( String.format( "%sruleKey(sha1=%s):", ruleKey.isIdempotent() ? "" : "non-idempotent ", ruleKey.toString())); } feed(ruleKey.toString().getBytes()).mergeIdempotence(ruleKey.isIdempotent()); } return separate(); }
public RuleKey build() { RuleKey ruleKey = idempotent ? new RuleKey(hasher.hash()) : new RuleKey(null); if (logElms != null) { logger.info( String.format( "%sRuleKey %s=%s", ruleKey.isIdempotent() ? "" : "non-idempotent ", ruleKey.toString(), Joiner.on("").join(logElms))); } return ruleKey; }
@Test public void testRuleKeyFromHashString() { RuleKey ruleKey = new RuleKey("19d2558a6bd3a34fb3f95412de9da27ed32fe208"); assertEquals("19d2558a6bd3a34fb3f95412de9da27ed32fe208", ruleKey.toString()); }