public String _classes(String... args) throws Exception { // Macro.verifyCommand(args, _classesHelp, new // Pattern[]{null,Pattern.compile("(implementing|implements|extending|extends|importing|imports|any)"), // null}, 3,3); Collection<Clazz> matched = getClasses(args); if (matched.isEmpty()) return ""; return join(matched); }
public String _classes(String... args) { // Macro.verifyCommand(args, _classesHelp, new // Pattern[]{null,Pattern.compile("(implementing|implements|extending|extends|importing|imports|any)"), // null}, 3,3); Collection<Clazz> matched = getClasses(args); if (matched.isEmpty()) return ""; return join(matched); }
/** * Check if annotations are actually feasible looking at the class * format. If the class format does not provide annotations then it is * no use specifying annotated components. * * @param name * @return * @throws Exception */ private Collection<Clazz> checkAnnotationsFeasible(String name) throws Exception { Collection<Clazz> not = analyzer.getClasses("", QUERY.NAMED.toString(), name // ); if (not.isEmpty()) if ( "*".equals(name)) return not; else error("Specified %s but could not find any class matching this pattern", name); for (Clazz c : not) { if (c.getFormat().hasAnnotations()) return not; } warning("Wildcards are used (%s) requiring annotations to decide what is a component. Wildcard maps to classes that are compiled with java.target < 1.5. Annotations were introduced in Java 1.5", name); return not; }
public boolean analyzeJar(Analyzer analyzer) throws Exception { Map<String, Map<String, String>> map = analyzer.parseHeader(analyzer .getProperty(Constants.METATYPE)); Jar jar = analyzer.getJar(); for (String name : map.keySet()) { Collection<Clazz> metatypes = analyzer.getClasses("", QUERY.ANNOTATION.toString(), Meta.OCD.class.getName(), // QUERY.NAMED.toString(), name // ); for (Clazz c : metatypes) { jar.putResource("OSGI-INF/metatype/" + c.getFQN() + ".xml", new MetaTypeReader(c, analyzer)); } } return false; } }
Collection<Clazz> annotatedComponents = analyzer.getClasses("", QUERY.ANNOTATION.toString(), Component.class.getName(), //