public final class Tools extends Object
Modifier and Type | Method and Description |
---|---|
static String |
fm(String message,
Object... values)
Substitutes all places of the message using a values.
|
static OffsetDateTime |
fromUTC(long utcMillis)
Converts UTC time in millis to local
OffsetDateTime with default time zone. |
static OffsetDateTime |
fromUTC(OffsetDateTime utcTime)
Converts UTC instant of
OffsetDateTime to local instant of OffsetDateTime with default time zone. |
static Set<String> |
getAllKnownPropertyNames(org.springframework.core.env.ConfigurableEnvironment env)
Gets all property names from
environment . |
static Properties |
getPropertiesWithPrefix(org.springframework.core.env.ConfigurableEnvironment env,
String propertyNamePrefix)
Gets
Properties from ConfigurableEnvironment with properties that name start with
prefix from parameter. |
static String |
joinNonEmpty(String[] array,
char separator)
Joins the provided input Strings into one String, separated by the provided separator character.
|
static String |
marshalToXml(Object obj,
Class sourceClass)
Marshals object graph into XML.
|
static <T> String |
marshalToXml(T obj,
QName qName)
Marshals object graph into XML.
|
static String |
toString(Object value)
Returns the string representation of the
Object argument. |
static OffsetDateTime |
toUTC(OffsetDateTime localDateTime)
Converts local instant of
OffsetDateTime to standard UTC instant of OffsetDateTime with UTC time zone. |
static <T> T |
unmarshalFromXml(String xml,
Class<T> targetClass)
Unmarshals XML into object graph.
|
public static String toString(Object value)
Object
argument.value
- an Object
.null
, then
null
; otherwise, the value of
value.toString()
is returned.public static String joinNonEmpty(String[] array, char separator)
array
- an array of String to join together into one Stringseparator
- separator character to separate the array elements withpublic static String marshalToXml(Object obj, Class sourceClass)
obj
- the object graphsourceClass
- the input classXmlConverter
public static <T> String marshalToXml(T obj, QName qName)
T
- as data type of objectobj
- the object graphqName
- the QNameMarshaller
public static <T> T unmarshalFromXml(String xml, Class<T> targetClass)
T
- as data type of target objectxml
- the input stringtargetClass
- the target classXmlConverter
public static OffsetDateTime toUTC(OffsetDateTime localDateTime)
OffsetDateTime
to standard UTC instant of OffsetDateTime
with UTC time zone.localDateTime
- the local timepublic static OffsetDateTime fromUTC(OffsetDateTime utcTime)
OffsetDateTime
to local instant of OffsetDateTime
with default time zone.utcTime
- the UTC timepublic static OffsetDateTime fromUTC(long utcMillis)
OffsetDateTime
with default time zone.utcMillis
- the UTC time in millispublic static Set<String> getAllKnownPropertyNames(org.springframework.core.env.ConfigurableEnvironment env)
environment
.env
- The environmentpublic static Properties getPropertiesWithPrefix(org.springframework.core.env.ConfigurableEnvironment env, String propertyNamePrefix)
Properties
from ConfigurableEnvironment
with properties that name start with
prefix from parameter.env
- environmentpropertyNamePrefix
- prefix for property namesProperties
with properties that name start with propertyNamePrefixpublic static String fm(String message, Object... values)
MessageFormatter
for more detail.message
- the message with places defined as {}values
- an array of values that are used to substitute formatting places of the messageCopyright © 2018 Pivotal Software, Inc.. All rights reserved.