/** * Gets the first value of a specific attribute, as a date and a time. * * This method only takes into account attributes of type * {@link GoogleBaseAttributeType#DATE_TIME}. * * * @param name attribute name * @return value of the attribute or null if no attribute * with this name was found on the list * @exception NumberFormatException if some value was * found that could not be converted */ public DateTime getDateTimeAttribute(String name) { return ConversionUtil.toDateOrDateTime( getAttributeAsString(name, GoogleBaseAttributeType.DATE_TIME)); }
/** * Gets the first value of a specific attribute, as a date and a time. * * This method only takes into account attributes of type * {@link GoogleBaseAttributeType#DATE_TIME}. * * * @param name attribute name * @return value of the attribute or null if no attribute * with this name was found on the list * @exception NumberFormatException if some value was * found that could not be converted */ public DateTime getDateTimeAttribute(String name) { return ConversionUtil.toDateOrDateTime( getAttributeAsString(name, GoogleBaseAttributeType.DATE_TIME)); }
/** * Gets the first value of a specific attribute, as a date. * * This method only takes into account attributes of type * {@link GoogleBaseAttributeType#DATE_TIME} and * {@link GoogleBaseAttributeType#DATE}. * * * @param name attribute name * @return value of the attribute or null if no attribute * with this name was found on the list * @exception NumberFormatException if some value was * found that could not be converted */ public DateTime getDateAttribute(String name) { return ConversionUtil.toDateOrDateTime( getAttributeAsString(name, GoogleBaseAttributeType.DATE)); }
/** * Gets the first value of a specific attribute, as a date. * * This method only takes into account attributes of type * {@link GoogleBaseAttributeType#DATE_TIME} and * {@link GoogleBaseAttributeType#DATE}. * * * @param name attribute name * @return value of the attribute or null if no attribute * with this name was found on the list * @exception NumberFormatException if some value was * found that could not be converted */ public DateTime getDateAttribute(String name) { return ConversionUtil.toDateOrDateTime( getAttributeAsString(name, GoogleBaseAttributeType.DATE)); }
/** * Extracts a {@link DateTimeRange} from the value of a * {@link com.google.api.gbase.client.GoogleBaseAttribute}. * * @param attribute * @exception NumberFormatException if the conversion failed, either * because on of the date/time was invalid or if the expected start * and end tags were missing */ public static DateTimeRange extractDateTimeRange(GoogleBaseAttribute attribute) { String range = attribute.getValueAsString(); int space = range.indexOf(' '); if (space == -1) { /* Not really a range, but since date and dateTime are subtypes * of DateTimeRange, try and convert them into a DateTimeRange. */ return new DateTimeRange(toDateOrDateTime(range)); } else { String startStr = range.substring(0, space); String endStr = range.substring(space+1); return new DateTimeRange(toDateOrDateTime(startStr), toDateOrDateTime(endStr)); } }
/** * Extracts a {@link DateTimeRange} from the value of a * {@link com.google.api.gbase.client.GoogleBaseAttribute}. * * @param attribute * @exception NumberFormatException if the conversion failed, either * because on of the date/time was invalid or if the expected start * and end tags were missing */ public static DateTimeRange extractDateTimeRange(GoogleBaseAttribute attribute) { String range = attribute.getValueAsString(); int space = range.indexOf(' '); if (space == -1) { /* Not really a range, but since date and dateTime are subtypes * of DateTimeRange, try and convert them into a DateTimeRange. */ return new DateTimeRange(toDateOrDateTime(range)); } else { String startStr = range.substring(0, space); String endStr = range.substring(space+1); return new DateTimeRange(toDateOrDateTime(startStr), toDateOrDateTime(endStr)); } }