Class ParserHelper
- java.lang.Object
-
- org.apache.sling.contentparser.api.ParserHelper
-
@ConsumerType public final class ParserHelper extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
convertSingleTypeArray(java.lang.Object[] values)
Converts a multi-value property to a single object.static java.util.Calendar
parseDate(java.lang.String string)
Attempts to parse astring
using first theISO_8601_MILLISECONDS_DATE_FORMAT
format and then theECMA_DATE_FORMAT
.
-
-
-
Method Detail
-
parseDate
public static java.util.Calendar parseDate(java.lang.String string)
Attempts to parse astring
using first theISO_8601_MILLISECONDS_DATE_FORMAT
format and then theECMA_DATE_FORMAT
.- Parameters:
string
- the string to parse- Returns:
- a
Calendar
containing the parsed date ornull
, if the parsing failed
-
convertSingleTypeArray
public static java.lang.Object convertSingleTypeArray(java.lang.Object[] values)
Converts a multi-value property to a single object.- Parameters:
values
- the multi-value property's values- Returns:
- an object representation of the multi-value property
- Throws:
java.lang.IllegalArgumentException
- when the providedvalues
array contains null values,Map
values, or the values are not of the same type
-
-