/** * Returns the item at the specified index of the list. If the item isn't yet an {@link TemplateModel}, it will wrap * it to one now, and writes it back into the backing list. */ public TemplateModel get(int index) throws TemplateModelException { try { Object value = list.get(index); if (value instanceof TemplateModel) { return (TemplateModel) value; } TemplateModel tm = wrap(value); list.set(index, tm); return tm; } catch (IndexOutOfBoundsException e) { return null; } }
/** * Returns the item at the specified index of the list. If the item isn't yet an {@link TemplateModel}, it will wrap * it to one now, and writes it back into the backing list. */ public TemplateModel get(int index) throws TemplateModelException { try { Object value = list.get(index); if (value instanceof TemplateModel) { return (TemplateModel) value; } TemplateModel tm = wrap(value); list.set(index, tm); return tm; } catch (IndexOutOfBoundsException e) { return null; } }
/** * Returns the item at the specified index of the list. If the item isn't yet an {@link TemplateModel}, it will wrap * it to one now, and writes it back into the backing list. */ public TemplateModel get(int index) throws TemplateModelException { try { Object value = list.get(index); if (value instanceof TemplateModel) { return (TemplateModel) value; } TemplateModel tm = wrap(value); list.set(index, tm); return tm; } catch (IndexOutOfBoundsException e) { return null; } }
/** * @return the specified index in the list */ public TemplateModel get(int i) throws TemplateModelException { try { Object value = list.get(i); if (value instanceof TemplateModel) { return (TemplateModel) value; } TemplateModel tm = wrap(value); list.set(i, tm); return tm; } catch(IndexOutOfBoundsException e) { return null; // throw new TemplateModelException(i + " out of bounds [0, " + list.size() + ")"); } }