/**
  * Configures a {@link Stub} with the given {@link Configuration}
  *
  * @param stub the stub that should be configured
  * @param parameters the configuration that should be used
  */
 static void configureStub(final Stub stub, final Configuration parameters) {
   final Class<? extends Stub> stubClass = stub.getClass();
   for (final Field stubField : stubClass.getDeclaredFields())
     if ((stubField.getModifiers() & (Modifier.TRANSIENT | Modifier.FINAL | Modifier.STATIC)) == 0)
       if (parameters.getString(stubField.getName(), null) != null)
         try {
           stubField.setAccessible(true);
           stubField.set(
               stub,
               SopremoUtil.deserializeCachingAware(
                   parameters,
                   stubField.getName(),
                   stubField.getType(),
                   stubField.getGenericType(),
                   stubClass.getClassLoader()));
         } catch (final Exception e) {
           LOG.error(
               String.format(
                   "Could not set field %s of class %s: %s",
                   stubField.getName(), stubClass, StringUtils.stringifyException(e)));
         }
 }