code: public static void encryptFields(Object object, CollectionMetaData cmd, ICipher cipher) 
        throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
      for (String secretAnnotatedFieldName: cmd.getSecretAnnotatedFieldNames()) {
        Method getterMethod = cmd.getGetterMethodForFieldName(secretAnnotatedFieldName);
        Method setterMethod = cmd.getSetterMethodForFieldName(secretAnnotatedFieldName);
  
        String value;
        String encryptedValue = null;
        try {
          value = (String)getterMethod.invoke(object);
          if (null != value) {
            encryptedValue = cipher.encrypt(value);
            setterMethod.invoke(object, encryptedValue);
          }
        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
          logger.error("Error when invoking method for a @Secret annotated field", e);
          throw e;
        }
      }
    }
docs: A utility method to encrypt the value of field marked by the @Secret annotation using its
  setter/mutator method.
  @param object the actual Object representing the POJO we want the Id of.
  @param cmd the CollectionMetaData object from which we can obtain the list
  containing names of fields which have the @Secret annotation
  @param cipher the actual cipher implementation to use
  @throws IllegalAccessException Error when invoking method for a @Secret annotated field due to permissions
  @throws IllegalArgumentException Error when invoking method for a @Secret annotated field due to wrong arguments
  @throws InvocationTargetException Error when invoking method for a @Secret annotated field, the method threw a exception