PicketLink Federation Core 2.1.6.Final-redhat-2

org.picketlink.identity.federation.core.util
Class StringUtil

java.lang.Object
  extended by org.picketlink.identity.federation.core.util.StringUtil

public class StringUtil
extends Object

Utility dealing with Strings

Since:
Oct 21, 2009
Author:
Anil.Saldhana@redhat.com

Constructor Summary
StringUtil()
           
 
Method Summary
static String decode(String maskedString, String salt, int iterationCount)
          Given a masked password String, decode it
static String getSystemPropertyAsString(String str)
           Get the system property value if the string is of the format ${sysproperty}
static boolean isNotNull(String str)
          Check whether the passed string is null or empty
static boolean isNullOrEmpty(String str)
          Check whether the string is null or empty
static void match(String first, String second)
          Match two strings else throw a RuntimeException
static List<String> tokenize(String str)
          Given a comma separated string, get the tokens as a List
static List<String> tokenize(String str, String delimiter)
          Given a delimited string, get the tokens as a List
static Map<String,String> tokenizeKeyValuePair(String keyValuePairString)
          Given a string that is comma delimited and contains key-value pairs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

isNotNull

public static boolean isNotNull(String str)
Check whether the passed string is null or empty

Parameters:
str -
Returns:

isNullOrEmpty

public static boolean isNullOrEmpty(String str)
Check whether the string is null or empty

Parameters:
str -
Returns:

getSystemPropertyAsString

public static String getSystemPropertyAsString(String str)

Get the system property value if the string is of the format ${sysproperty}

You can insert default value when the system property is not set, by separating it at the beginning with ::

Examples:

${idp} should resolve to a value if the system property "idp" is set.

${idp::http://localhost:8080} will resolve to http://localhost:8080 if the system property "idp" is not set.

Parameters:
str -
Returns:

match

public static void match(String first,
                         String second)
Match two strings else throw a RuntimeException

Parameters:
first -
second -

tokenize

public static List<String> tokenize(String str)
Given a comma separated string, get the tokens as a List

Parameters:
str -
Returns:

tokenize

public static List<String> tokenize(String str,
                                    String delimiter)
Given a delimited string, get the tokens as a List

Parameters:
str -
delimiter - the delimiter
Returns:

tokenizeKeyValuePair

public static Map<String,String> tokenizeKeyValuePair(String keyValuePairString)
Given a string that is comma delimited and contains key-value pairs

Parameters:
keyValuePairString -
Returns:

decode

public static String decode(String maskedString,
                            String salt,
                            int iterationCount)
                     throws Exception
Given a masked password String, decode it

Parameters:
maskedString - a password string that is masked
salt - Salt
iterationCount - Iteration Count
Returns:
Decoded String
Throws:
Exception

PicketLink Federation Core 2.1.6.Final-redhat-2

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.