From 8d7120e20af4ac7e9f6cbc92e3bf2a12ea8aee54 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Wed, 25 Jun 2008 19:20:58 +0000 Subject: [PATCH] added one more convenience method. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@10419 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/Hudson.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index cffc998c29..279175deda 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -688,6 +688,17 @@ public final class Hudson extends View implements ItemGroup, Node, return new ArrayList(items.values()); } + /** + * Gets just the immediate children of {@link Hudson} but of the given type. + */ + public List getItems(Class type) { + List r = new ArrayList(); + 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.