Package com.evolveum.midpoint.prism.xml
Class XmlTypeConverter
- java.lang.Object
-
- com.evolveum.midpoint.prism.xml.XmlTypeConverter
-
public class XmlTypeConverter extends Object
Simple implementation that converts XSD primitive types to Java (and vice versa).It convert type names (xsd types to java classes) and also the values.
The implementation is very simple now. In fact just a bunch of ifs. We don't need much more now. If more complex thing will be needed, we will extend the implementation later. TODO clean this up as it is now part of prism-api!
- Author:
- Radovan Semancik
-
-
Constructor Summary
Constructors Constructor Description XmlTypeConverter()
-
Method Summary
-
-
-
Method Detail
-
canConvert
public static boolean canConvert(Class<?> clazz)
-
canConvert
public static boolean canConvert(QName xsdType)
-
createXMLGregorianCalendar
public static XMLGregorianCalendar createXMLGregorianCalendar()
-
createXMLGregorianCalendar
public static XMLGregorianCalendar createXMLGregorianCalendar(Long timeInMillis)
-
createXMLGregorianCalendar
@Contract("null -> null") public static XMLGregorianCalendar createXMLGregorianCalendar(Date date)
-
createXMLGregorianCalendar
public static XMLGregorianCalendar createXMLGregorianCalendar(String string)
-
createXMLGregorianCalendarFromIso8601
public static XMLGregorianCalendar createXMLGregorianCalendarFromIso8601(String iso8601string)
-
createXMLGregorianCalendar
public static XMLGregorianCalendar createXMLGregorianCalendar(GregorianCalendar cal)
-
createXMLGregorianCalendar
public static XMLGregorianCalendar createXMLGregorianCalendar(ZonedDateTime zdt)
-
toZonedDateTime
public static ZonedDateTime toZonedDateTime(XMLGregorianCalendar xcal)
-
createXMLGregorianCalendar
@Contract("null -> null; !null -> !null") public static XMLGregorianCalendar createXMLGregorianCalendar(XMLGregorianCalendar cal)
-
createXMLGregorianCalendar
@TestOnly public static XMLGregorianCalendar createXMLGregorianCalendar(int year, int month, int day, int hour, int minute, int second, int millisecond, int timezone)
-
createXMLGregorianCalendar
@TestOnly public static XMLGregorianCalendar createXMLGregorianCalendar(int year, int month, int day, int hour, int minute, int second)
-
toMillis
public static long toMillis(XMLGregorianCalendar xmlCal)
-
toMillisNullable
public static Long toMillisNullable(XMLGregorianCalendar xmlCal)
-
toDate
public static Date toDate(XMLGregorianCalendar xmlCal)
-
fromNow
public static XMLGregorianCalendar fromNow(String timeSpec)
-
fromNow
public static XMLGregorianCalendar fromNow(Duration duration)
-
fromNow
public static XMLGregorianCalendar fromNow(long now, Duration duration)
-
fromNow
public static XMLGregorianCalendar fromNow(long now, String timeSpec)
-
toMillis
public static long toMillis(Duration duration)
-
createDuration
public static Duration createDuration(long durationInMilliSeconds)
-
isZero
public static boolean isZero(Duration duration)
-
createDuration
public static Duration createDuration(boolean isPositive, int years, int months, int days, int hours, int minutes, int seconds)
-
fromXmlEnum
public static <T> String fromXmlEnum(T enumValue)
-
addDuration
public static XMLGregorianCalendar addDuration(XMLGregorianCalendar now, Duration duration)
-
addDuration
public static XMLGregorianCalendar addDuration(XMLGregorianCalendar now, String duration)
-
addMillis
public static XMLGregorianCalendar addMillis(XMLGregorianCalendar now, long duration)
-
compare
public static int compare(XMLGregorianCalendar o1, XMLGregorianCalendar o2)
-
compareMillis
public static int compareMillis(XMLGregorianCalendar o1, XMLGregorianCalendar o2)
-
isBeforeNow
public static boolean isBeforeNow(XMLGregorianCalendar time)
-
isAfterInterval
public static boolean isAfterInterval(XMLGregorianCalendar reference, Duration interval, XMLGregorianCalendar now)
-
laterTimestamp
public static XMLGregorianCalendar laterTimestamp(XMLGregorianCalendar a, XMLGregorianCalendar b)
-
isFresher
public static boolean isFresher(XMLGregorianCalendar theTimestamp, XMLGregorianCalendar refTimestamp)
-
toJavaValue
public static Object toJavaValue(Element xmlElement, QName type) throws SchemaException
- Throws:
SchemaException
-
toJavaValue
public static <T> T toJavaValue(String stringContent, Map<String,String> namespaces, QName typeQName)
-
toJavaValue
public static <T> T toJavaValue(Element xmlElement, Class<T> type) throws SchemaException
- Throws:
SchemaException
-
toJavaValue
public static <T> T toJavaValue(String textContent, Map<String,String> namespaces, Class<T> type)
-
toJavaValue
public static <T> T toJavaValue(String stringContent, Class<T> type, boolean exceptionOnUnknown)
-
isAfterNullLast
public static boolean isAfterNullLast(XMLGregorianCalendar v1, XMLGregorianCalendar v2)
-
-