mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 14:02:22 +00:00
added one more convenience method.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@10419 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
3f75aaef77
commit
8d7120e20a
1 file changed
+11
@@ -688,6 +688,17 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node,
|
||||
return new ArrayList<TopLevelItem>(items.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets just the immediate children of {@link Hudson} but of the given type.
|
||||
*/
|
||||
public <T extends TopLevelItem> List<T> getItems(Class<T> type) {
|
||||
List<T> r = new ArrayList<T>();
|
||||
for (TopLevelItem i : items.values())
|
||||
if (type.isInstance(i))
|
||||
r.add(type.cast(i));
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the {@link Item}s recursively in the {@link ItemGroup} tree
|
||||
* and filter them by the given type.
|
||||
|
||||
Reference in new issue
Block a user