/** * check if the specified XMLGregorianCalendar instance is a valid {@odf.datatype time} data type * * @param time the value to be tested * @return true if the value of argument is valid for {@odf.datatype time} data type false * otherwise */ public static boolean isValid(XMLGregorianCalendar time) { if (time == null) { return false; } else { return W3CSchemaType.isValid("time", time.toXMLFormat()); } }
/** * check if the specified URI instance is a valid {@odf.datatype anyURI} data type * * @param uri the value to be tested * @return true if the value of argument is valid for {@odf.datatype anyURI} data type false * otherwise */ public static boolean isValid(URI uri) { boolean isValid = false; if (uri != null) { isValid = W3CSchemaType.isValid("anyURI", uri.toString()); } return isValid; }
/** * Construct an newly Time object that represents the specified XMLGregorianCalendar value * * @param time the value to be represented by the Time Object * @throws IllegalArgumentException if the given argument is not a valid Time */ public Time(XMLGregorianCalendar time) throws IllegalArgumentException { if (time == null) { throw new IllegalArgumentException("parameter can not be null for Time"); } // validate 'time' type which is defined in W3C schema // http://www.w3.org/TR/xmlschema-2/#time if (!W3CSchemaType.isValid("time", time.toXMLFormat())) { throw new IllegalArgumentException("parameter is invalid for datatype Time"); } mTime = time; }
/** * Construct an newly AnyURI object that represents the specified URI value * * @param uri the value to be represented by the AnyURI Object * @throws IllegalArgumentException if the given argument is not a valid AnyURI */ public AnyURI(URI uri) throws IllegalArgumentException { if (uri == null) { throw new IllegalArgumentException("parameter can not be null for AnyURI"); } // validate 'anyURI' type which is defined in W3C schema // http://www.w3.org/TR/xmlschema-2/#anyURI if (!W3CSchemaType.isValid("anyURI", URITransformer.decodePath(uri.toString()))) { Logger.getLogger(AnyURI.class.getName()) .log(Level.SEVERE, "parameter is invalid for datatype AnyURI"); throw new IllegalArgumentException("parameter is invalid for datatype anyURI"); } mURI = uri; }