/** * This method returns the same list as {@link #all()}, with all those * classes removed that do <b>not</b> match the given regular expression * on the class name. */ //public static DescriptorExtensionList<AbstractProjectReference,ProjectReferenceDescriptor> all(String classNameExp) { public static List<ProjectReferenceDescriptor> all(String classNameExp) { Pattern p = Pattern.compile(classNameExp); DescriptorExtensionList<AbstractProjectReference,ProjectReferenceDescriptor> all = all(); LinkedList<ProjectReferenceDescriptor> reduced = new LinkedList<ProjectReferenceDescriptor>(); ListIterator<ProjectReferenceDescriptor> iter = all.listIterator(); while (iter.hasNext()) { ProjectReferenceDescriptor d = iter.next(); Matcher mFull = p.matcher(d.clazz.getName()); Matcher mPart = p.matcher(d.clazz.getSimpleName()); /* if (!mFull.matches() && !mPart.matches()) { //This entry is not wanted at all iter.remove(); } */ if (mFull.matches() || mPart.matches()) { reduced.add(d); } } return reduced; }
/** * This method returns the same list as {@link #all()}, with all those * classes removed that do <b>not</b> match the given regular expression * on the class name. */ //public static DescriptorExtensionList<AbstractProjectReference,ProjectReferenceDescriptor> all(String classNameExp) { public static List<ProjectReferenceDescriptor> all(String classNameExp) { Pattern p = Pattern.compile(classNameExp); DescriptorExtensionList<AbstractProjectReference,ProjectReferenceDescriptor> all = all(); LinkedList<ProjectReferenceDescriptor> reduced = new LinkedList<ProjectReferenceDescriptor>(); ListIterator<ProjectReferenceDescriptor> iter = all.listIterator(); while (iter.hasNext()) { ProjectReferenceDescriptor d = iter.next(); Matcher mFull = p.matcher(d.clazz.getName()); Matcher mPart = p.matcher(d.clazz.getSimpleName()); /* if (!mFull.matches() && !mPart.matches()) { //This entry is not wanted at all iter.remove(); } */ if (mFull.matches() || mPart.matches()) { reduced.add(d); } } return reduced; }