Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. package net.thoughtforge.cache.key;
  2.  
  3. import org.apache.commons.lang.StringUtils;
  4.  
  5. public class DigestMethodSignatureKeyGenerator extends AbstractMethodSignatureKeyGenerator {
  6.  
  7. private String algorithm;
  8.  
  9. @Override
  10. protected Key createKey(final String keyValue) {
  11. try {
  12. if (StringUtils.isEmpty(algorithm)) {
  13. return new DigestKey(keyValue);
  14. } else {
  15. return new DigestKey(keyValue, algorithm);
  16. }
  17. } catch (final Exception exception) {
  18. throw new KeyGeneratorException(exception);
  19. }
  20. }
  21.  
  22. public void setAlgorithm(final String algorithm) {
  23. this.algorithm = algorithm;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement