public class

JiraUtils

extends Object
java.lang.Object
   ↳ com.atlassian.jira.util.JiraUtils

Class Overview

Miscellaneous utility methods. Most have moved into more specific classes.

Summary

Constants
String AM
String PM
Public Constructors
JiraUtils()
Public Methods
static int get24HourTime(String meridianIndicator, int hours)
Calculate meridian adjustment add 12 hours if meridian is set to PM - note 12pm is 12:00 in 24 hour time.
static boolean isPublicMode()
Returns true if JIRA is really running in public mode.
static boolean isSetup()
static <T> T loadComponent(String className, ClassLoader classLoader)
This method is deprecated. This method does not work well with Plugins2 classes and dependency injection. Please use ComponentClassManager.
static <T> T loadComponent(Class<T> componentClass, Collection<Object> extraParameters)
static <T> T loadComponent(String className, Class<?> callingClass)
This method will load and construct a class, but also pass it through PicoContainer, to inject any dependencies.
static <T> T loadComponent(Class<T> componentClass)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String AM

Constant Value: "am"

public static final String PM

Constant Value: "pm"

Public Constructors

public JiraUtils ()

Public Methods

public static int get24HourTime (String meridianIndicator, int hours)

Calculate meridian adjustment add 12 hours if meridian is set to PM - note 12pm is 12:00 in 24 hour time.

Parameters
meridianIndicator am or pm
hours 1-12
Returns
  • 1-24

public static boolean isPublicMode ()

Returns true if JIRA is really running in public mode.

That is, JIRA Mode is enabled AND there is at least one writable User Directory.

JRA-15966 Public mode should only be allowed if External User Management is disabled, otherwise we cannot create a new user in JIRA. Older versions of JIRA would allow the admin to set up an invalid combination of both External User Management and Public Mode enabled, and so we need to account for this possibility.

Returns
  • true if we allow public signup in this JIRA instance.

public static boolean isSetup ()

public static T loadComponent (String className, ClassLoader classLoader)

This method is deprecated.
This method does not work well with Plugins2 classes and dependency injection. Please use ComponentClassManager.

This method will load and construct a class, but also pass it through PicoContainer, to inject any dependencies. Please note that this method will only find Plugins2 classes in plugins that are enabled, and cannot inject plugins2 components.

Parameters
className the name of the class to load
classLoader the classloader to use to load the class
Returns
  • the instance of the requested class
Throws
ClassNotFoundException if the given className was not able to be loaded.

public static T loadComponent (Class<T> componentClass, Collection<Object> extraParameters)

public static T loadComponent (String className, Class<?> callingClass)

This method will load and construct a class, but also pass it through PicoContainer, to inject any dependencies.

Parameters
className the name of the class to load.
callingClass the class requesting the class be loaded.
Returns
  • the instance of the requested class.
Throws
ClassNotFoundException if the class is not found on the classpath of the classloader of the calling class.

public static T loadComponent (Class<T> componentClass)