Skip navigation links


oracle.iam.policyengine.vo
Class Util

java.lang.Object
  extended by oracle.iam.policyengine.vo.Util


public class Util
extends java.lang.Object

Field Summary
static java.lang.String DATE_FORMAT_AM_PM
           
static java.lang.String DATE_FORMAT_CANONICAL
          Deprecated. Will become a private constant since this doesn't handle parsing a general IS0-8601 format. (Only handles our subset). Instead always use the public methods stringToDate and getCanonicalDateString. (At some point we may want to handle parsing a general IS0-8601 format).
static java.lang.String DATE_FORMAT_COMPACT
          Year-month-day with twenty-four-hour time: "yyyyMMdd HH:mm:ss"
static java.lang.String DATE_FORMAT_DEFAULT
           
static java.lang.String DATE_FORMAT_MILLIS
          Timestamp in milliseconds (a stringified Java long value).
static java.lang.String DATE_FORMAT_NO_SPACE
           
static java.util.TimeZone TIME_ZONE_CANONICAL
           

 

Constructor Summary
Util()
           

 

Method Summary
static java.lang.String dateToString(java.util.Date src)
          Format a Date value as a String, using the usual "American" format with the current time zone.
static java.lang.String dateToString(java.util.Date date, java.lang.String simpleDateFormatPattern)
           
static java.util.List decodeCommaString(java.lang.String src)
          Parse a comma delimited string into a List of strings.
static java.util.List decodeCommaString(java.lang.String src, boolean filterEmpty)
           
static void flattenList(java.util.List inList, java.util.List retList)
          Flatten out an input list that may contain list entries.
static java.lang.String getCanonicalDateString(java.util.Date date, java.util.TimeZone timeZone)
           
static int getInt(java.lang.Object v)
          Coerce an Object into an int primitive.
static boolean isNumeric(java.lang.String s)
           
static boolean isPath(java.lang.String s)
          Determine if string is a path.
static java.lang.String itoa(int i)
          Convert an primitive integer value into a String.
static java.lang.String lpad(java.lang.String str, int length)
          Left-pad a string to the specified length.
static java.lang.String lpad(java.lang.String str, int length, char padChar)
          Left-pad a string to the specified length with the specified character.
static java.lang.String pad(java.lang.String s, int len, char pad, boolean leftPad)
           
static void splitPathAroundLastDot(java.lang.String tmpPath, java.lang.StringBuilder sbVo, java.lang.StringBuilder sbAttr)
          Divide up a path based on the last '.' in the path.
static java.util.Date stringToDate(java.lang.String src)
          Convert the string representation for a date into a Date object.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

DATE_FORMAT_COMPACT

public static final java.lang.String DATE_FORMAT_COMPACT
Year-month-day with twenty-four-hour time: "yyyyMMdd HH:mm:ss"
See Also:
Constant Field Values

DATE_FORMAT_DEFAULT

public static final java.lang.String DATE_FORMAT_DEFAULT
See Also:
Constant Field Values

DATE_FORMAT_AM_PM

public static final java.lang.String DATE_FORMAT_AM_PM
See Also:
Constant Field Values

DATE_FORMAT_NO_SPACE

public static final java.lang.String DATE_FORMAT_NO_SPACE
See Also:
Constant Field Values

DATE_FORMAT_CANONICAL

public static final java.lang.String DATE_FORMAT_CANONICAL
Deprecated. Will become a private constant since this doesn't handle parsing a general IS0-8601 format. (Only handles our subset). Instead always use the public methods stringToDate and getCanonicalDateString. (At some point we may want to handle parsing a general IS0-8601 format).
IS0-8601 date format.
See Also:
Constant Field Values

TIME_ZONE_CANONICAL

public static java.util.TimeZone TIME_ZONE_CANONICAL

DATE_FORMAT_MILLIS

public static final java.lang.String DATE_FORMAT_MILLIS
Timestamp in milliseconds (a stringified Java long value).
See Also:
Constant Field Values

Constructor Detail

Util

public Util()

Method Detail

isNumeric

public static boolean isNumeric(java.lang.String s)
Parameters:
s - string
Returns:
true if the specified string contains only digits or decimal points, and possibly a leading minus sign. Cheaper than catching an exception from a parse method.

stringToDate

public static java.util.Date stringToDate(java.lang.String src)
                                   throws java.text.ParseException
Convert the string representation for a date into a Date object. The string may be of the following forms: M/d/y H:m:s z M/d/y H:m:s M/d/y yyyyMMdd HH:mm:ss (default) yyyyMMdd HH:mm:ss.SSS (old canonical) yyyyMMddTHH:mm:ss.SSS (old canonical absolute) yyyy-MM-ddTHH:mm:ss.SSSZ (canonical, no offset) yyyy-MM-ddTHH:mm:ss.SSS+/-HHMM (canonical, offset) nnnnnnnnnnnnnnnnn (milliseconds)
Throws:
java.text.ParseException
See Also:
Util.DATE_FORMAT_COMPACT, Util.DATE_FORMAT_DEFAULT, Util.DATE_FORMAT_MILLIS

dateToString

public static java.lang.String dateToString(java.util.Date src)
Format a Date value as a String, using the usual "American" format with the current time zone. NOTE: The "American" format doesn't sort worth a damn.

decodeCommaString

public static java.util.List decodeCommaString(java.lang.String src)
Parse a comma delimited string into a List of strings.
Parameters:
src - comma separated list of values
Returns:
list of values

decodeCommaString

public static java.util.List decodeCommaString(java.lang.String src,
                                               boolean filterEmpty)

dateToString

public static java.lang.String dateToString(java.util.Date date,
                                            java.lang.String simpleDateFormatPattern)
Returns:
a string representing a specified date in the specified format.

getCanonicalDateString

public static java.lang.String getCanonicalDateString(java.util.Date date,
                                                      java.util.TimeZone timeZone)
Returns:
An IS0-8601 formatted date string

lpad

public static java.lang.String lpad(java.lang.String str,
                                    int length)
Left-pad a string to the specified length. Pad a numeric string with zeros, any other with the space character.
Parameters:
str - string
length - length for padded string
Returns:
left padded string
See Also:
Util.isNumeric(String)

lpad

public static java.lang.String lpad(java.lang.String str,
                                    int length,
                                    char padChar)
Left-pad a string to the specified length with the specified character.
Parameters:
str - string
length - length for pad
padChar - character to use for padding
Returns:
padded string

pad

public static java.lang.String pad(java.lang.String s,
                                   int len,
                                   char pad,
                                   boolean leftPad)
Parameters:
s - - the input string to pad.
len - - pad to this length.
pad - - pad with this character.
leftPad - - if true, prepend pad characters; otherwise, append.
Returns:
the input string, padded to a specified length.

getInt

public static int getInt(java.lang.Object v)
Coerce an Object into an int primitive.
Parameters:
v - number or string representation of a number
Returns:
int value, possibly truncated, of v

itoa

public static java.lang.String itoa(int i)
Convert an primitive integer value into a String. This doesn't really save much space, but its the obvious inverse to atoi.
Parameters:
i - integer
Returns:
String representation of i

flattenList

public static void flattenList(java.util.List inList,
                               java.util.List retList)
Flatten out an input list that may contain list entries. Flattened list is contained in retList No entries are removed from retList. Only new non-List entities are added.
Parameters:
inList -
retList -

isPath

public static boolean isPath(java.lang.String s)
Determine if string is a path. It is a path if it contains a '.' or '[' character. This was done to replace 2 indexOf() calls which were found to be taking a significant amount of time for some scenarios
Parameters:
s -
Returns:
true if a path, false otherwise

splitPathAroundLastDot

public static void splitPathAroundLastDot(java.lang.String tmpPath,
                                          java.lang.StringBuilder sbVo,
                                          java.lang.StringBuilder sbAttr)
Divide up a path based on the last '.' in the path. sbVo will contain everything to the left and sbAttr will contain everything to the right If path does not have any '.' characters then entire path is put into sbVo
Parameters:
tmpPath -
sbVo -
sbAttr -

Skip navigation links


Copyright © 2015, Oracle and/or its affiliates. All rights reserved.