package de.steamwar.command; import de.steamwar.command.dto.TestSWCommand; import de.steamwar.command.dto.TestTypeMapper; import java.util.Arrays; import java.util.Collection; import java.util.concurrent.atomic.AtomicInteger; public class CacheCommand extends TestSWCommand { public CacheCommand() { super("typemapper"); } @Register public void test(String sender, int tabCompleteTest) { } private AtomicInteger count = new AtomicInteger(); @Cached @Mapper(value = "int", local = true) public AbstractTypeMapper typeMapper() { System.out.println("TypeMapper register"); return new TestTypeMapper() { @Override public Integer map(String sender, String[] previousArguments, String s) { return Integer.parseInt(s); } @Override public Collection tabCompletes(String sender, String[] previousArguments, String s) { return Arrays.asList(count.getAndIncrement() + ""); } }; } }