I too have wanted this recently. Take a look at the Duration <https://github.com/dropwizard/dropwizard/blob/master/dropwizard-util/src/main/java/io/dropwizard/util/Duration.java#L71-L83> and Size <https://github.com/dropwizard/dropwizard/blob/master/dropwizard-util/src/main/java/io/dropwizard/util/Size.java> classes in dropwizard-util. Perhaps a `io.dropwizard.util.Path` class could similarly use a @JsonCreator'd `parse` method to translate a string from a config file into a java.nio.Path field of a Configuration class. The `parse` function could invoke `Files.exists()` to ensure that the file exists.
On Wed, May 18, 2016 at 4:04 PM, Mario Steinhoff <[email protected]> wrote: > Hi everyone, > > I have a dropwizard service which performs local file I/O, so I added a > java.nio.Path attribute to my application config class. > > When dropwizard starts, I want to check if that path exists, so I figured > I need some code at the right place that calls Files.exists() on the path > value. > > The hibernate validation seems appropriate for this but I am a bit stuck > here. Could someone point me in the right direction how to accomplish this? > > Thanks :) > Mario > > -- > You received this message because you are subscribed to the Google Groups > "dropwizard-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Evan Meagher -- You received this message because you are subscribed to the Google Groups "dropwizard-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
