Example usage for org.apache.commons.lang3 StringUtils split

List of usage examples for org.apache.commons.lang3 StringUtils split

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils split.

Prototype

public static String[] split(final String str, final String separatorChars) 

Source Link

Document

Splits the provided text into an array, separators specified.

Usage

From source file:edu.bu.kuali.kra.award.options.FederalRateAgreementDateValuesFinder.java

/**
 * @see org.kuali.rice.krad.keyvalues.KeyValuesBase#getKeyValues()
 *///from  w  w w .j  av a2s  . c o m
public List getKeyValues() {
    /*ParameterService parameterService = (ParameterService) KcServiceLocator
        .getService("parameterService");*/
    Collection<String> paramValues = getParameterService().getParameterValuesAsString(AwardDocument.class,
            BUConstants.FEDERAL_RATE_DATE_OVERHEAD_KEY_FIELD_MAPPINGS);

    List<ConcreteKeyValue> keyValues = new ArrayList<ConcreteKeyValue>();
    keyValues.add(0, new ConcreteKeyValue("NA", "N/A"));
    for (String paramValue : paramValues) {
        String[] keyValueString = StringUtils.split(paramValue, "=");
        keyValues.add(new ConcreteKeyValue(keyValueString[0], keyValueString[0]));
    }
    return keyValues;
}

From source file:com.jdom.util.properties.PropertiesUtil.java

public static List<String> getPropertyAsList(Properties properties, String key) {
    String[] split = StringUtils.split(properties.getProperty(key), SEPARATOR);
    return (split != null && split.length > 0) ? Arrays.asList(split) : new ArrayList<String>();
}

From source file:com.xpn.xwiki.plugin.XWikiPluginManager.java

public XWikiPluginManager(String classList, XWikiContext context) {
    String[] classNames = StringUtils.split(classList, " ,");
    addPlugins(classNames, context);
}

From source file:io.hakbot.controller.plugin.RemoteInstanceAutoConfig.java

public Map<String, RemoteInstance> createMap(Plugin.Type pluginType, String pluginId) {
    LOGGER.info("Initializing instance properties");
    final Map<String, RemoteInstance> instanceMap = new HashMap<>();
    final String type = pluginType.name().toLowerCase();
    final String[] instances = StringUtils
            .split(Config.getInstance().getProperty(type + "." + pluginId + ".instances"), ",");
    if (instances == null) {
        LOGGER.info("Instances were not specified. Unable to autoconfigure.");
        return instanceMap;
    }//from  ww  w.  j a  v a2  s.  co m
    for (String instanceIdentifier : instances) {
        instanceIdentifier = instanceIdentifier.trim();
        final RemoteInstance instance = generateInstance(pluginType, pluginId, instanceIdentifier);
        instanceMap.putIfAbsent(instance.getAlias(), instance);
    }
    return instanceMap;
}

From source file:net.gtaun.wl.race.importer.SraceImporter.java

@Override
public void importTrack(File file) throws Throwable {
    Ini ini = new Ini(file);

    Section trackInfo = ini.get("TrackInfo");
    String name = file.getName().replace(".ini", "");
    String desc = trackInfo.get("Description");
    String author = trackInfo.get("Designer");

    Section checkpointInfo = ini.get("CheckpointInfo");
    int checkpointCount = Integer.parseInt(checkpointInfo.get("Count"));

    Radius[] checkpointPos = new Radius[checkpointCount];
    for (int i = 0; i < checkpointCount; i++) {
        String line = checkpointInfo.get("Checkpoint" + (i + 1));
        String[] splits = StringUtils.split(line, ',');
        checkpointPos[i] = new Radius(Float.parseFloat(splits[0]), Float.parseFloat(splits[1]),
                Float.parseFloat(splits[2]), Float.parseFloat(splits[3]));
    }//w w  w. j av  a  2  s. c om

    Track track = trackManager.createTrack(author, name);
    track.setDesc(desc);
    for (int i = 0; i < checkpointCount; i++) {
        TrackCheckpoint checkpoint = track.createCheckpoint(checkpointPos[i]);
        checkpoint.setSize(checkpointPos[i].getRadius());
    }

    track.setStatus(TrackStatus.COMPLETED);
}

From source file:com.anrisoftware.prefdialog.miscswing.filetextfield.FileDisplayFormatter.java

@Override
public String valueToString(Object value) throws ParseException {
    if (value == null) {
        return "";
    }//from   w ww .j  ava  2 s. c  o  m
    absolutePath = asAbsolutePath((File) value);
    splitAbsolutePath = StringUtils.split(absolutePath, separatorChar);
    text = createShortPath(getFormattedTextField().getWidth());
    return text;
}

From source file:edu.sjsu.cohort6.openstack.server.filter.BasicAuthenticationFilter.java

private String[] credentialsFrom(final String encodedHeader) {
    return StringUtils.split(encodedHeader != null ? decodeHeader(encodedHeader) : null, ":");
}

From source file:com.nerve.commons.repository.utils.reflection.ReflectionUtils.java

/**
 * Setter, ???/*from  w  w  w.  java  2s . c om*/
 * ???.??.
 */
public static void invokeSetter2(Object obj, String propertyName, Object value) {
    Object object = obj;
    String[] names = StringUtils.split(propertyName, ".");
    for (int i = 0; i < names.length; i++) {
        if (i < names.length - 1) {
            String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]);
            object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
        } else {
            String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]);
            invokeMethodByName(object, setterMethodName, new Object[] { value });
        }
    }
}

From source file:name.martingeisse.miner.server.tools.RegionConverter.java

private void handleRegionFile(File regionFile) throws Exception {
    System.out.println("region file: " + regionFile.getName());
    String[] segments = StringUtils.split(regionFile.getName(), '.');
    baseChunkX = Integer.parseInt(segments[1]) * 32;
    baseChunkZ = Integer.parseInt(segments[2]) * 32;
    regionParser.parse(regionFile);/*from w  w  w  . j a v a2 s .  c  o m*/
}

From source file:com.l2jserver.util.transformer.impl.ArrayTransformer.java

@Override
@SuppressWarnings("unchecked")
public T[] untransform(Class<? extends T[]> type, String stringValue) {
    final Transformer<T> transformer = (Transformer<T>) TransformerFactory
            .getTransfromer(type.getComponentType());
    final String[] stringValues = StringUtils.split(stringValue, '|');
    final Object values = Array.newInstance(type.getComponentType(), stringValues.length);
    int i = 0;//w  w w  .j a v  a 2 s . c  o  m
    for (final String value : stringValues) {
        Array.set(values, i++, transformer.untransform((Class<T>) type.getComponentType(), value));
    }

    return type.cast(values);
}