public List<PageBreakLocations> getPageBreakLocations(String key) { List<PageBreakLocations> result = configuration.getList(PageBreakLocations.class, key); if(result == null) result = new ArrayList<PageBreakLocations>(); return result; }
@Override public Object get(final String name, final int index) { if (!checkIndexedProperty(name)) { throw new IllegalArgumentException("Property '" + name + "' is not indexed."); } final List<Object> list = getConfiguration().getList(name); return list.get(index); }
public List<PageBreakLocations> getPageBreakLocations(String key) { List<PageBreakLocations> result = configuration.getList(PageBreakLocations.class, key); if(result == null) result = new ArrayList<PageBreakLocations>(); return result; }
public List<PageBreakLocations> getPageBreakLocations(String key) { List<PageBreakLocations> result = configuration.getList(PageBreakLocations.class, key); if(result == null) result = new ArrayList<PageBreakLocations>(); return result; }
public List<String> ignoreFilesWithStrings() { List<String> l = _config.getList(String.class, BfConsts.ARG_IGNORE_FILES_WITH_STRINGS); return l == null ? ImmutableList.of() : l; }
protected final List<String> getStringListOptionValue(String key) { if (_line.hasOption(key)) { String[] optionValues = _line.getOptionValues(key); if (optionValues == null) { _config.setProperty(key, ImmutableList.of()); } else { _config.setProperty(key, ImmutableList.of(Arrays.asList(optionValues))); } } return _config.getList(String.class, key); }
protected final List<Path> getPathListOptionValue(String key) { if (_line.hasOption(key)) { String[] optionValues = _line.getOptionValues(key); if (optionValues != null) { _config.setProperty( key, Arrays.stream(optionValues) .map(BaseSettings::nullablePath) .filter(Objects::nonNull) .map(Path::toString) .collect(ImmutableList.toImmutableList())); } } List<String> s = _config.getList(String.class, key); return s == null ? ImmutableList.of() : s.stream().map(Paths::get).collect(ImmutableList.toImmutableList()); }
return (T) Integer.valueOf(getConfiguration().getInt(name)); } else if (List.class.equals(type)) { return (T) getConfiguration().getList(name); } else if (Long.class.equals(type) || long.class.equals(type)) { return (T) Long.valueOf(getConfiguration().getLong(name));
@Override @SuppressWarnings("unchecked") public <T> T getProperty(String key, Class<T> valueClass) { T result = null; try { if (String.class == valueClass) { result = (T) getConfiguration().getString(key); } else if (List.class.isAssignableFrom(valueClass)) { result = (T) getConfiguration().getList(key); } else if (Properties.class.isAssignableFrom(valueClass)) { result = (T) getConfiguration().getProperties(key); } else { Object value = getProperty(key); if (value != null) { result = this.converterManager.convert(valueClass, getProperty(key)); } } } catch (org.apache.commons.configuration2.ex.ConversionException | org.xwiki.properties.converter.ConversionException e) { throw new org.xwiki.configuration.ConversionException( "Key [" + key + "] is not compatible with type [" + valueClass.getName() + "]", e); } return result; }
public static RichIterable<DbMergeInfo> parseFromProperties(Configuration config) { MutableSet<String> dbs = CollectionAdapter.wrapSet(config.getList(String.class, "instances", Lists.mutable.<String>empty()));
public static RichIterable<DbMergeInfo> parseFromProperties(Configuration config) { MutableSet<String> dbs = CollectionAdapter.wrapSet(config.getList(String.class, "instances", Lists.mutable.<String>empty()));