/** * Retrieves the i-th object from the collection, wrapped as a TemplateModel. * @throws TemplateModelException if the index is out of bounds, or the * underlying collection is not a List. */ public TemplateModel get(int index) throws TemplateModelException { // Don't forget to keep getSupportsIndexedAccess in sync with this! if (object instanceof List) { try { return wrap(((List) object).get(index)); } catch (IndexOutOfBoundsException e) { return null; // throw new TemplateModelException("Index out of bounds: " + index); } } else { throw new TemplateModelException("Underlying collection is not a list, it's " + object.getClass().getName()); } }
/** * Retrieves the i-th object from the collection, wrapped as a TemplateModel. * @throws TemplateModelException if the index is out of bounds, or the * underlying collection is not a List. */ public TemplateModel get(int index) throws TemplateModelException { // Don't forget to keep getSupportsIndexedAccess in sync with this! if (object instanceof List) { try { return wrap(((List) object).get(index)); } catch (IndexOutOfBoundsException e) { return null; // throw new TemplateModelException("Index out of bounds: " + index); } } else { throw new TemplateModelException("Underlying collection is not a list, it's " + object.getClass().getName()); } }
/** * Retrieves the i-th object from the collection, wrapped as a TemplateModel. * @throws TemplateModelException if the index is out of bounds, or the * underlying collection is not a List. */ public TemplateModel get(int index) throws TemplateModelException { // Don't forget to keep getSupportsIndexedAccess in sync with this! if (object instanceof List) { try { return wrap(((List) object).get(index)); } catch (IndexOutOfBoundsException e) { return null; // throw new TemplateModelException("Index out of bounds: " + index); } } else { throw new TemplateModelException("Underlying collection is not a list, it's " + object.getClass().getName()); } }
/** * Retrieves the i-th object from the collection, wrapped as a TemplateModel. * @throws TemplateModelException if the index is out of bounds, or the * underlying collection is not a List. */ public TemplateModel get(int index) throws TemplateModelException { // Don't forget to keep getSupportsIndexedAccess in sync with this! if (object instanceof List) { try { return wrap(((List)object).get(index)); } catch(IndexOutOfBoundsException e) { return null; // throw new TemplateModelException("Index out of bounds: " + index); } } else { throw new TemplateModelException("Underlying collection is not a list, it's " + object.getClass().getName()); } }