package com.dmnlk.sample;

import com.codahale.metrics.annotation.Timed;
import com.google.common.base.Optional;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import java.util.concurrent.atomic.AtomicLong;

/**
 * @author dmnlk
 */
@Path("/hello")
@Produces(MediaType.APPLICATION_JSON)
public class SampleResource {
    private final String template;
    private final String defaultName;
    private final AtomicLong counter;

    public SampleResource(String template, String defaultName) {
        this.template = template;
        this.defaultName = defaultName;
        this.counter = new AtomicLong();
    }

    @GET
    @Timed
    public Saying sayHello(@QueryParam("name")Optional<String> name) {
        final String value = String.format(template, name.or(defaultName));
        return  new Saying(counter.incrementAndGet(), value);
    }

}

@@ -66,16 +66,55 @@
 .Timed;%0A
+import com.dmnlk.doma.dao.TAccountDao;%0A
 import c
@@ -558,16 +558,59 @@
 counter;
+%0A    private final TAccountDao tAccountDao;
 %0A%0A    pu
@@ -664,16 +664,33 @@
 aultName
+, TAccountDao dao
 ) %7B%0A    
@@ -800,16 +800,48 @@
 Long();%0A
+        this.tAccountDao = dao;%0A
     %7D%0A%0A 

use DAo