/** * Appends the members of the supplied array to this list. * * @param toappend The array of Strings to be appended, which may be * <code>null</code>. */ public void append(String[] toappend) { if (toappend != null) { for (int i = 0; i < toappend.length; ++i) { add(toappend[i]); } } }
static public StringList getListing(File aStartingDir, int mask) { StringList result = new StringList(); File[] filesAndDirs = aStartingDir.listFiles(); if (filesAndDirs == null) { return result; } for (int i = 0; i < filesAndDirs.length; ++ i) { File file = filesAndDirs[i]; if (!file.isFile()) { if ((mask & DIRECTORY_MASK) != 0) { result.add(file.toString()); } StringList deeperList = getListing(file, mask); result.addAll(deeperList); } else { if ((mask & FILE_MASK) != 0) { result.add(file.toString()); } } } //Collections.sort(result); return result; }
public void addPath(String path) { paths.add(path); }
public void invokeRunnable(Runnable towrap) { String flowtoken = flowidholder.getFlowToken(); final StringList completelocks = new StringList(); if (flowtoken != null) { completelocks.add(flowtoken); } completelocks.addAll(scopelocks); if (completelocks.size() == 0) { towrap.run(); return; } Collections.sort(completelocks); // Avoid potential Dedlocks! try { lockUUPP(completelocks, towrap, 0); } finally { lockgetter.returnLock(flowtoken); } }
public ErrorObject(String message, String handlerID, Throwable t) { this.message = message; this.handlerID = handlerID; if (t != null) { StackTraceElement[] trace = t.getStackTrace(); for (int i = 0; i < trace.length; ++i) { stacktrace.add(trace[i].toString()); } } } }
public void append(Collection toappend) { for (Iterator it = toappend.iterator(); it.hasNext();) { String next = (String) it.next(); // ensure ClassCastException if wrong type add(next); } }
public StringList resolveTemplatePath(ViewParameters viewparams) { StringList togo = new StringList(); ConsumerInfo ci = ciproxy.get(); if (ci.consumertype != null) { String consumerprefix = ci.consumertype + CONSUMERTYPE_SEPARATOR; togo.add(basedir + consumerprefix + viewparams.viewID); } togo.add(basedir + viewparams.viewID); return togo; }
public StringList(String string) { ensureCapacity(2); add(string); }
/** Push the supplied path segment onto the hidden path base * @param extrapath segment to add */ public void pushNestedPath(String extrapath) { if (extrapath == null) { extrapath = ""; } if (extrapath.length() > 0 && !extrapath.endsWith(".")) { extrapath += '.'; } if (pathstack == null) { pathstack = new StringList(); } pathstack.add(nestedpath); this.nestedpath = nestedpath + extrapath; }
/** * Construct a StringList from a comma separated list of Strings, trimming * whitespace. * * @param commasep comma separated string * @return a StringList */ public static StringList fromString(String commasep) { String[] strings = commasep.split(","); StringList togo = new StringList(); for (int i = 0; i < strings.length; ++i) { String toadd = strings[i].trim(); // ensure that empty string produces empty list if (toadd.length() != 0 || strings.length > 1) { togo.add(toadd); } } return togo; } }
public static void addStaticStrings(Object provider, String xfix, boolean prefix, StringList strings) { Class provclass = provider instanceof Class ? (Class) provider : provider.getClass(); Field[] fields = provclass.getFields(); for (int j = 0; j < fields.length; ++j) { Field field = fields[j]; try { int modifiers = field.getModifiers(); if (!isPublicStatic(modifiers)) continue; String fieldname = field.getName(); if ((prefix ? fieldname.startsWith(xfix) : fieldname.endsWith(xfix)) && field.getType() == String.class) { strings.add(field.get(provider)); } } catch (Throwable t) { Logger.log.fatal("Error reflecting for static names ", t); } } } }
/** * Appends the members of the supplied list to this list. * * @param toappend The list of Strings to be appended, which may be * <code>null</code>. */ public void append(StringList toappend) { if (toappend != null) { for (int i = 0; i < toappend.size(); ++i) { add(toappend.get(i)); } } }
public void setCopyPreservingBeans(String copyPreservingBeans) { StringList specs = StringList.fromString(copyPreservingBeans); if (copyPreservingBeans.indexOf(SPEC_SPLIT_CHAR) != -1) { copyPreservingBeanList = new StringList(); targetPreservingKeyList = new StringList(); for (int i = 0; i < specs.size(); ++ i) { String spec = specs.stringAt(i); int splitpos = spec.indexOf(SPEC_SPLIT_CHAR); String bean = null, key = null; if (splitpos == -1) { bean = key = spec; } else { bean = spec.substring(0, splitpos); key = spec.substring(splitpos + 1); } copyPreservingBeanList.add(bean); targetPreservingKeyList.add(key); } } else { copyPreservingBeanList = specs; } }
/** * Returns a list of bean names which are known to correspond to beans * implementing or derived from the supplied class. RSAC has tried slightly * harder to resolve bean classes than Spring generally does, through walking * chains of factory-methods. * * @param clazz A class or interface class to be searched for. * @return A list of derived bean names. */ public String[] beanNamesForClass(Class clazz) { StringList togo = new StringList(); String[] beanNames = blankcontext.getBeanDefinitionNames(); for (int i = 0; i < beanNames.length; i++) { String beanname = beanNames[i]; RSACBeanInfo rbi = (RSACBeanInfo) rbimap.get(beanname); if (rbi.beanclass != null && !rbi.isabstract && clazz.isAssignableFrom(rbi.beanclass)) { togo.add(beanname); } } return togo.toStringArray(); }
/** Disused method */ public List getInvalidatingEntries(String path) { ArrayList togo = new ArrayList(); String[] splitEL = PathUtil.splitPath(path); StringList goup = new StringList(); for (int i = 0; i < splitEL.length; ++ i) { goup.add(splitEL[i]); String upstring = PathUtil.buildPath(goup.toStringArray()); List deps = (List) writemap.get(upstring); if (deps != null) { togo.addAll(deps); } } return togo; } }
/** * Renders the entire contents of this message list into a list of localised * messages, using the supplied <code>MessageLocator</code> * @param locator messages * @return localized messages */ public StringList render(MessageLocator locator) { StringList togo = new StringList(); for (int i = 0; i < size(); ++i) { TargettedMessage message = messageAt(i); togo.add(message.message != null? message.message : locator.getMessage(message.messagecodes, message.args)); } return togo; }
/** * Parses a path into an array of decoded EL segments * * @param path path to split * @return array */ public static String[] splitPath(String path) { StringList togo = new StringList(); CharWrap build = new CharWrap(); int index = 0; while (index < path.length()) { index = PathUtil.getPathSegment(build, path, index) + 1; togo.add(build.toString()); build.clear(); } return togo.toStringArray(); }
public StringList restore(WriteableBeanLocator target) { StringList togo = new StringList(); for (int i = 0; i < managers.length; ++i) { String scopename = managers[i].getScopeName(); int restored = strategies[i].restore(target, scopename); if (restored != 0) { String tshkey = strategies[i].getTokenStateHolder().getId(); if (managers[i].getExclusive()) { togo.add(tshkey + "-" + scopename); } } } return togo; }
public void resolveTemplateStream(TemplateResolutionContext trc) { String resourcebase = "/"; if (trc.trs instanceof BaseAwareTemplateResolverStrategy) { BaseAwareTemplateResolverStrategy batrs = (BaseAwareTemplateResolverStrategy) trc.trs; resourcebase = batrs.getTemplateResourceBase(); } String extension = tei.inferTemplateExtension(trc.viewparams); InputStream is = null; trc.fullpath = null; for (int i = 0; i < trc.bases.size(); ++i) { trc.fullpath = resourcebase + trc.bases.stringAt(i) + "." + extension; if (trc.tried != null) { trc.tried.add(trc.fullpath); } is = cachingiis.openStream(trc.fullpath); if (is != null) break; if (is == null && trc.logfailure) { // This is not a real failure for other content types - see RSF-21 // Logger.log.warn("Failed to load template from " + fullpath); } } trc.is = is; }