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.ObjectconvertSingleTypeArray(java.lang.Object[] values)Converts a multi-value property to a single object.static java.util.CalendarparseDate(java.lang.String string)Attempts to parse astringusing first theISO_8601_MILLISECONDS_DATE_FORMATformat and then theECMA_DATE_FORMAT.
-
-
-
Method Detail
-
parseDate
public static java.util.Calendar parseDate(java.lang.String string)
Attempts to parse astringusing first theISO_8601_MILLISECONDS_DATE_FORMATformat and then theECMA_DATE_FORMAT.- Parameters:
string- the string to parse- Returns:
- a
Calendarcontaining 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 providedvaluesarray contains null values,Mapvalues, or the values are not of the same type
-
-