/** * Generate a Granularity instance based on a path element. * * @param granularity A string representation of the granularity * @param dateTimeZone The time zone to use for this granularity * @param granularityParser The parser for granularity * * @return A granularity instance with time zone information * @throws BadApiRequestException if the string matches no meaningful granularity */ protected Granularity generateGranularity( @NotNull String granularity, @NotNull DateTimeZone dateTimeZone, @NotNull GranularityParser granularityParser ) throws BadApiRequestException { try { return granularityParser.parseGranularity(granularity, dateTimeZone); } catch (GranularityParseException e) { LOG.error(UNKNOWN_GRANULARITY.logFormat(granularity), granularity); throw new BadApiRequestException(e.getMessage()); } }
/** * Generate a Granularity instance based on a path element. * * @param granularity A string representation of the granularity * @param granularityParser The parser for granularity * * @return A granularity instance without time zone information * @throws BadApiRequestException if the string matches no meaningful granularity */ protected Granularity generateGranularity(String granularity, GranularityParser granularityParser) throws BadApiRequestException { try { return granularityParser.parseGranularity(granularity); } catch (GranularityParseException e) { LOG.error(UNKNOWN_GRANULARITY.logFormat(granularity), granularity); throw new BadApiRequestException(e.getMessage(), e); } }