private boolean shouldEncrypt(Map.Entry<String, String> property, Set<String> passwordProperties) {
    return passwordProperties.contains(property.getKey()) && !isEncryptedPassword(property.getValue());
  }
A common base class for various encryptor implementations
ambari-server/src/main/java/org/apache/ambari/server/security/encryption/PropertiesEncryptor.java