Package org.beanio.internal.util
Class StringUtil
- java.lang.Object
-
- org.beanio.internal.util.StringUtil
-
public final class StringUtil extends java.lang.Object
Utility class for working withStrings
.- Since:
- 2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
StringUtil.PropertySource
A source of property values.
-
Field Summary
Fields Modifier and Type Field Description protected static boolean
LAZY_IF_EMPTY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
doPropertySubstitution(java.lang.String text, java.util.Properties properties)
Substitutes${key,default}
place holders with their property values.static java.lang.String
doPropertySubstitution(java.lang.String text, StringUtil.PropertySource properties)
Substitutes${key,default}
place holders with their property values.static boolean
hasValue(java.lang.Object obj)
Returns whether the given object has a value.
-
-
-
Method Detail
-
hasValue
public static boolean hasValue(java.lang.Object obj)
Returns whether the given object has a value.- Parameters:
obj
- the object to test- Returns:
- true if the object is not null (and not the empty string based on configuration)
-
doPropertySubstitution
public static java.lang.String doPropertySubstitution(java.lang.String text, java.util.Properties properties) throws java.lang.IllegalArgumentException
Substitutes${key,default}
place holders with their property values.- Parameters:
text
- the template textproperties
- the user provided property values- Returns:
- the text after property substitution
- Throws:
java.lang.IllegalArgumentException
- if a property value does not exist
-
doPropertySubstitution
public static java.lang.String doPropertySubstitution(java.lang.String text, StringUtil.PropertySource properties) throws java.lang.IllegalArgumentException
Substitutes${key,default}
place holders with their property values.- Parameters:
text
- the template textproperties
- the user provided property values- Returns:
- the text after property substitution
- Throws:
java.lang.IllegalArgumentException
- if a property value does not exist
-
-