/** * Closes any resources acquired during initialization or otherwise. */ @Override public void close() throws IOException { for(int idx = 0; idx < registries.length; ++idx) { registries[idx].close(); } }
public CompositeRegistryIterator() { this.count = registries.length; this.idx = 0; this.iterator = registries[idx].iterator(); }
@Override public void reload() throws DirectiveLoadException { for(int idx = 0; idx < registries.length; ++idx) { registries[idx].reload(); } }
/** * This method looks for the <tt>directive</tt> in all the registered registries. * * <p>The order of search is as specified by the collection order. Upon finding * the first valid instance of directive, the <tt>DirectiveInfo</tt> is returned.</p> * * @param directive of the directive to be retrived from the registry. * @return an instance of {@link DirectiveInfo} if found, else null. */ @Nullable @Override public DirectiveInfo get(String directive) throws DirectiveLoadException { for(int i = 0; i < registries.length; ++i) { DirectiveInfo info = registries[i].get(directive); if (info != null) { return info; } } return null; }
/** * Returns an <tt>JsonElement</tt> representation of this implementation of object. * Arrays, Sets are represented as <tt>JsonArray</tt> and other object and map types * are represented as <tt>JsonObject</tt>. * * @return An instance of {@link JsonElement} of this object. */ @Override public JsonElement toJson() { JsonArray array = new JsonArray(); for (int i = 0; i < registries.length; ++i) { JsonElement element = registries[i].toJson(); array.add(element); } return array; }
DirectiveInfo info = registry.get(root); if (info == null) { throw new DirectiveNotFoundException(
/** * @return Returns true if there exists registry that's not been iterated in entiry, else false. */ @Override public boolean hasNext() { boolean status = iterator.hasNext(); if (status == false && idx < count - 1) { idx = idx + 1; iterator = registries[idx].iterator(); if (iterator.hasNext()) { status = true; } } return status; }