/** * Determines the fetch attributes from the current node. * * @return fetch attributes to use. * @since 0.7 */ private FetchAttributes getFetchAttributes() { final FetchAttributes attributes = new FetchAttributes(); final String fetchHint = (String) getAttribute(Goto.ATTRIBUTE_FETCHHINT); if (fetchHint != null) { attributes.setFetchHint(fetchHint); } final String fetchTimeout = (String) getAttribute(Goto.ATTRIBUTE_FETCHTIMEOUT); if (fetchTimeout != null) { final TimeParser parser = new TimeParser(fetchTimeout); final long seconds = parser.parse(); attributes.setFetchTimeout(seconds); } final String maxage = (String) getAttribute(Goto.ATTRIBUTE_MAXAGE); if (maxage != null) { final TimeParser parser = new TimeParser(maxage); final long seconds = parser.parse(); attributes.setMaxage(seconds); } final String maxstale = (String) getAttribute(Goto.ATTRIBUTE_MAXSTALE); if (maxstale != null) { final TimeParser parser = new TimeParser(maxstale); final long seconds = parser.parse(); attributes.setMaxstale(seconds); } return attributes; }
/** * Copy constructor. * * @param attributes fetch attributes to copy from. */ public FetchAttributes(final FetchAttributes attributes) { fetchAudio = attributes.getFetchAudio(); fetchHint = attributes.getFetchHint(); fetchTimeout = attributes.getFetchTimeout(); maxage = attributes.getMaxage(); maxstale = attributes.getMaxstale(); }