/** * Returns the ClassDescriptors for the given implementations. Returns null if the Model hasn't * been set. Throw a RuntimeException if any of the classes named in the implementations * parameter aren't in the Model. * * @param implementations the interfaces that this item implements * @return the ClassDescriptors for the given implementations. Returns null if the Model hasn't * been set */ protected List<ClassDescriptor> getImplementClassDescriptors(String implementations) { if (implementationClassDescriptors == null) { Map<String, List<ClassDescriptor>> cache = getImplementClassDescriptorsCache.get(); implementationClassDescriptors = cache.get(implementations); if (implementationClassDescriptors == null) { implementationClassDescriptors = new ArrayList<ClassDescriptor>(); String [] bits = StringUtil.split(implementations, " "); for (String clsName : bits) { if (!StringUtils.isEmpty(clsName)) { implementationClassDescriptors.add(getClassDescriptorByName(clsName)); } } cache.put(implementations, implementationClassDescriptors); } } return implementationClassDescriptors; }
/** * Returns the ClassDescriptors for the given implementations. Returns null if the Model hasn't * been set. Throw a RuntimeException if any of the classes named in the implementations * parameter aren't in the Model. * * @param implementations the interfaces that this item implements * @return the ClassDescriptors for the given implementations. Returns null if the Model hasn't * been set */ protected List<ClassDescriptor> getImplementClassDescriptors(String implementations) { if (implementationClassDescriptors == null) { Map<String, List<ClassDescriptor>> cache = getImplementClassDescriptorsCache.get(); implementationClassDescriptors = cache.get(implementations); if (implementationClassDescriptors == null) { implementationClassDescriptors = new ArrayList<ClassDescriptor>(); String [] bits = StringUtil.split(implementations, " "); for (String clsName : bits) { if (!StringUtils.isEmpty(clsName)) { implementationClassDescriptors.add(getClassDescriptorByName(clsName)); } } cache.put(implementations, implementationClassDescriptors); } } return implementationClassDescriptors; }
String classAndFieldName = key.substring(0, key.lastIndexOf(".")); List<Object> fieldValues = new ArrayList<Object>(Arrays.asList(StringUtil.split(value, FIELD_DELIM))); for (int j = 0; j < fieldValues.size(); j++) { if (fieldValues.get(j).equals(NULL_MARKER)) { } else if (key.endsWith(NULL_FIELDS_SUFFIX)) { String className = key.substring(0, key.lastIndexOf(".")); List<String> fieldNames = Arrays.asList(StringUtil.split(value, FIELD_DELIM)); emptyFieldsMap.put(className, new TreeSet<String>(fieldNames)); } else if (key.endsWith(EMPTY_ATTRIBUTES_SUFFIX)) { String className = key.substring(0, key.lastIndexOf(".")); List<String> attributeNames = Arrays.asList(StringUtil.split(value, FIELD_DELIM)); emptyAttributesMap.put(className, new TreeSet<String>(attributeNames)); } else if (key.equals(MAX_FIELD_VALUES)) {
String classAndFieldName = key.substring(0, key.lastIndexOf(".")); List<Object> fieldValues = new ArrayList<Object>(Arrays.asList(StringUtil.split(value, FIELD_DELIM))); for (int j = 0; j < fieldValues.size(); j++) { if (fieldValues.get(j).equals(NULL_MARKER)) { } else if (key.endsWith(NULL_FIELDS_SUFFIX)) { String className = key.substring(0, key.lastIndexOf(".")); List<String> fieldNames = Arrays.asList(StringUtil.split(value, FIELD_DELIM)); emptyFieldsMap.put(className, new TreeSet<String>(fieldNames)); } else if (key.endsWith(EMPTY_ATTRIBUTES_SUFFIX)) { String className = key.substring(0, key.lastIndexOf(".")); List<String> attributeNames = Arrays.asList(StringUtil.split(value, FIELD_DELIM)); emptyAttributesMap.put(className, new TreeSet<String>(attributeNames)); } else if (key.equals(MAX_FIELD_VALUES)) {
/** * Populate the ID resolver from a tab delimited file * * @param f the file * @throws IOException if we can't read from the file */ protected void createFromFile(File f) throws IOException { // data is in format: // ZDBID ID1,ID2,ID3 Iterator<?> lineIter = FormattedTextParser. parseTabDelimitedReader(new BufferedReader(new FileReader(f))); while (lineIter.hasNext()) { String[] line = (String[]) lineIter.next(); if (line.length < 2 || line[0].startsWith("#") || !line[0].startsWith(GENE_PATTERN)) { continue; } String zfinId = line[0]; String[] synonyms = StringUtil.split(line[1].trim(), ","); resolver.addMainIds(taxonId, zfinId, Collections.singleton(zfinId)); resolver.addSynonyms(taxonId, zfinId, new HashSet<String>(Arrays.asList(synonyms))); } } }
new HashSet<String>(Arrays.asList(StringUtil.split(synonymsStr, "|"))));
Set<Class<?>> trackerMissingClasses = new HashSet<Class<?>>(); if (trackerMissingClassesString != null) { String[] trackerMissingClassesStrings = StringUtil.split( trackerMissingClassesString, ","); for (String trackerMissingClassString : trackerMissingClassesStrings) {
Set<Class<?>> trackerMissingClasses = new HashSet<Class<?>>(); if (trackerMissingClassesString != null) { String[] trackerMissingClassesStrings = StringUtil.split( trackerMissingClassesString, ","); for (String trackerMissingClassString : trackerMissingClassesStrings) {
String[] resArray = StringUtil.split(testString, "$_^"); List<String> expected = Arrays.asList(new String [] {"", "abc", "defaaa bbb ccc", "zzzzz", ""}); assertEquals(expected, Arrays.asList(resArray)); String[] resArray = StringUtil.split(testString, "splitter_string"); assertEquals("", resArray[0]); String[] resArray = StringUtil.split(testString, "_"); List<String> expected = Arrays.asList(new String [] {"abc", "def"}); assertEquals(expected, Arrays.asList(resArray)); String[] resArray = StringUtil.split(testString, "XXX"); List<String> expected = Arrays.asList(new String [] {"", "", ""}); assertEquals(expected, Arrays.asList(resArray)); String[] resArray = StringUtil.split(testString, "XXX"); List<String> expected = Arrays.asList(new String [] {"", "a", "b"}); assertEquals(expected, Arrays.asList(resArray)); String[] resArray = StringUtil.split(testString, "XX"); List<String> expected = Arrays.asList(new String [] {" a b c ", " d e f ", " h i j ", ""}); assertEquals(expected, Arrays.asList(resArray)); StringUtil.split(testString, ""); fail("Expected: IllegalArgumentException"); } catch (IllegalArgumentException e) { StringUtil.split(null, "XXX"); fail("Expected: NullPointerException");
assertEquals("Expected: " + iql + ", but was: " + got, iql, got); } catch (Exception e) { if (!Arrays.asList(StringUtil.split(iql, "|")).contains(e.getMessage())) { throw e; summaryPath = null; } catch (Exception e) { if (!Arrays.asList(StringUtil.split(summary, "|")).contains(e.getMessage())) { throw e;