Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package io.dropwizard.jdbi;
 
 
 public class OptionalContainerFactory implements ContainerFactory<Optional<?>> {
 
     @Override
    public boolean accepts(Class<?> type) {
        return Optional.class.isAssignableFrom(type);
    }
    @Override
    public ContainerBuilder<Optional<?>> newContainerBuilderFor(Class<?> type) {
        return new OptionalContainerBuilder();
    }
    private static class OptionalContainerBuilder implements ContainerBuilder<Optional<?>> {
        Optional<?> optional = Optional.absent();
        @Override
        public ContainerBuilder<Optional<?>> add(Object it) {
             = Optional.fromNullable(it);
            return this;
        }
        @Override
        public Optional<?> build() {
            return ;
        }
    }
New to GrepCode? Check out our FAQ X