1 7 8 package javax.tools; 9 10 import javax.tools.JavaFileManager.Location; 11 12 import java.io.File ; 13 import java.util.*; 14 import java.util.concurrent.*; 15 16 22 public enum StandardLocation implements Location { 23 24 27 CLASS_OUTPUT, 28 29 32 SOURCE_OUTPUT, 33 34 37 CLASS_PATH, 38 39 42 SOURCE_PATH, 43 44 47 ANNOTATION_PROCESSOR_PATH, 48 49 53 PLATFORM_CLASS_PATH; 54 55 65 public static Location locationFor(final String name) { 66 if (locations.isEmpty()) { 67 for (Location location : values()) 69 locations.putIfAbsent(location.getName(), location); 70 } 71 locations.putIfAbsent(name.toString(), new Location() { 72 public String getName() { return name; } 73 public boolean isOutputLocation() { return name.endsWith("_OUTPUT"); } 74 }); 75 return locations.get(name); 76 } 77 private static ConcurrentMap<String ,Location> locations 79 = new ConcurrentHashMap<String ,Location>(); 80 81 public String getName() { return name(); } 82 83 public boolean isOutputLocation() { 84 return this == CLASS_OUTPUT || this == SOURCE_OUTPUT; 85 } 86 } 87 | Popular Tags |