From 4f2626aaac65a6e96693cb22fc3ca42380efb2e7 Mon Sep 17 00:00:00 2001 From: Vojtech Juranek Date: Wed, 3 Jul 2013 16:11:15 +0200 Subject: [PATCH] Add convenient method for checking if object is MatrixProject This is useful for jelly pages where instanceof operator doesn't work. --- core/src/main/java/hudson/Functions.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 781afece9c..f7e8a2106d 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -28,6 +28,7 @@ package hudson; import hudson.cli.CLICommand; import hudson.console.ConsoleAnnotationDescriptor; import hudson.console.ConsoleAnnotatorFactory; +import hudson.matrix.MatrixProject; import hudson.model.AbstractProject; import hudson.model.Action; import hudson.model.Describable; @@ -187,6 +188,10 @@ public class Functions { public static boolean isModelWithChildren(Object o) { return o instanceof ModelObjectWithChildren; } + + public static boolean isMatrixProject(Object o) { + return o instanceof MatrixProject; + } public static String xsDate(Calendar cal) { return Util.XS_DATETIME_FORMATTER.format(cal.getTime());