gluu
静的公開メンバ関数 | 非公開メンバ関数 | 静的非公開変数類 | 全メンバ一覧
org.xdi.oxd.server.Utils クラス
org.xdi.oxd.server.Utils 連携図
Collaboration graph

静的公開メンバ関数

static boolean isTestMode ()
 
static String getUmaDiscoveryUrl (String p_amHost)
 
static String joinAndUrlEncode (Collection< String > list) throws UnsupportedEncodingException
 
static String encode (String str) throws UnsupportedEncodingException
 
static int hoursDiff (Date earlierDate, Date laterDate)
 
static long date (Date date)
 
static String encodeCredentials (String username, String password) throws UnsupportedEncodingException
 
static boolean isValidUrl (String url)
 
static boolean isTrue (Boolean bool)
 

非公開メンバ関数

 Utils ()
 

静的非公開変数類

static final int ONE_HOUR_MILLIS = 60 * 60 * 1000
 
static final String APP_MODE = System.getProperty("app.mode")
 

詳解

Utility class with static methods.

著者
Yuriy Zabrovarnyy

構築子と解体子

◆ Utils()

org.xdi.oxd.server.Utils.Utils ( )
inlineprivate

Avoid instance creation.

35  {
36  }

関数詳解

◆ date()

static long org.xdi.oxd.server.Utils.date ( Date  date)
inlinestatic
71  {
72  return date != null ? date.getTime() / 1000 : 0;
73  }
static long date(Date date)
Definition: Utils.java:71

◆ encode()

static String org.xdi.oxd.server.Utils.encode ( String  str) throws UnsupportedEncodingException
inlinestatic
58  {
59  return URLEncoder.encode(str, "UTF-8");
60  }

◆ encodeCredentials()

static String org.xdi.oxd.server.Utils.encodeCredentials ( String  username,
String  password 
) throws UnsupportedEncodingException
inlinestatic
75  {
76  return Base64.encodeBase64String(Util.getBytes(username + ":" + password));
77  }

◆ getUmaDiscoveryUrl()

static String org.xdi.oxd.server.Utils.getUmaDiscoveryUrl ( String  p_amHost)
inlinestatic
47  {
48  return String.format("https://%s/.well-known/uma2-configuration", p_amHost);
49  }

◆ hoursDiff()

static int org.xdi.oxd.server.Utils.hoursDiff ( Date  earlierDate,
Date  laterDate 
)
inlinestatic
62  {
63  if (earlierDate == null || laterDate == null) {
64  return 0;
65  }
66 
67  int result = (int) ((laterDate.getTime() / ONE_HOUR_MILLIS) - (earlierDate.getTime() / ONE_HOUR_MILLIS));
68  return result >= 0 ? result : 0;
69  }
static final int ONE_HOUR_MILLIS
Definition: Utils.java:25

◆ isTestMode()

static boolean org.xdi.oxd.server.Utils.isTestMode ( )
inlinestatic

Returns whether app is in test mode.

戻り値
whether app is in test mode
43  {
44  return "test".equals(APP_MODE);
45  }
static final String APP_MODE
Definition: Utils.java:30

◆ isTrue()

static boolean org.xdi.oxd.server.Utils.isTrue ( Boolean  bool)
inlinestatic
91  {
92  return bool != null && bool;
93  }

◆ isValidUrl()

static boolean org.xdi.oxd.server.Utils.isValidUrl ( String  url)
inlinestatic
79  {
80  if (StringUtils.isNotBlank(url)) {
81  try {
82  new URL(url);
83  return true;
84  } catch (MalformedURLException e) {
85  // ignore
86  }
87  }
88  return false;
89  }

◆ joinAndUrlEncode()

static String org.xdi.oxd.server.Utils.joinAndUrlEncode ( Collection< String >  list) throws UnsupportedEncodingException
inlinestatic
51  {
52  if (list == null || list.isEmpty()) {
53  return "";
54  }
55  return encode(Joiner.on(" ").join(list));
56  }
static String encode(String str)
Definition: Utils.java:58

メンバ詳解

◆ APP_MODE

final String org.xdi.oxd.server.Utils.APP_MODE = System.getProperty("app.mode")
staticprivate

Application mode string

◆ ONE_HOUR_MILLIS

final int org.xdi.oxd.server.Utils.ONE_HOUR_MILLIS = 60 * 60 * 1000
staticprivate

このクラス詳解は次のファイルから抽出されました: