Example usage for org.apache.commons.lang StringUtils join

List of usage examples for org.apache.commons.lang StringUtils join

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils join.

Prototype

public static String join(Collection<?> collection, String separator) 

Source Link

Document

Joins the elements of the provided Collection into a single String containing the provided elements.

Usage

From source file:com.ms.commons.test.common.OutputUtil.java

synchronized public static String dump() {
    return StringUtils.join(cache, "\n");
}

From source file:net.savcode.fopmr.commands.C_gtfo.java

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    if (!Rank.isAdmin(sender)) {
        sender.sendMessage(NO_PERM);/* w w w. j a v  a  2s .c  om*/
        return true;
    }

    if (args.length == 0) {
        return false;
    }

    final String reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
    Player target = Bukkit.getServer().getPlayer(args[0]);

    if (args.length == 1) {
        if (target == null) {
            sender.sendMessage(PLAYER_NOT_FOUND);
            return false;
        }
        FOPMR_Utils.bcastMsg(target.getName() + "has been a VERY naughty, naughty boy. \nBanning: "
                + target.getName() + ", IP: "
                + FOPMR_ConfigEntry.PlayerConfig().getString(target.getUniqueId().toString() + ".ip"));
        target.kickPlayer(ChatColor.RED + "GTFO");
        FOPMR_Bans.addBan(target, sender);
    }

    if (args.length > 1) {
        if (reason != null) {
            FOPMR_Utils.bcastMsg(target.getName() + "has been a VERY naughty, naughty boy. \nBanning: "
                    + target.getName() + ", IP: "
                    + FOPMR_ConfigEntry.PlayerConfig().getString(target.getUniqueId().toString() + ".ip")
                    + "\nReason: " + ChatColor.GOLD + reason);
            target.kickPlayer(ChatColor.RED + "GTFO");
            FOPMR_Bans.addBan(target, sender, reason);
        }
    }
    return true;
}

From source file:com.microsoft.azure.shortcuts.services.samples.RegionsSample.java

public static void test(Azure azure) throws Exception {
    // List regions supporting VM
    Set<String> regionNames = azure.regions().list(LocationAvailableServiceNames.PERSISTENTVMROLE).keySet();
    System.out.println("Available regions supporting VMs: " + StringUtils.join(regionNames, ", "));

    // List all regions info
    Map<String, Region> regions = azure.regions().asMap();
    for (Region r : regions.values()) {
        printRegion(r);//w  w  w.  ja v a  2 s .  com
    }

    // Get info about a specific region
    Region region = azure.regions("West US");
    printRegion(region);
}

From source file:com.stratio.explorer.notebook.utils.ScriptObjectBuilder.java

public String buildNotHiddenWith(KeyValue... keyValues) {
    String open = "{", close = "}";
    List<String> listKeyValue = new ArrayList<>();
    for (KeyValue keyValue : keyValues) {
        listKeyValue.add(keyValue.toStringSeparateBysimbol(simbolSeparator));
    }/*from w  w w  . j a  va  2 s . c  om*/
    return open + StringUtils.join(listKeyValue, ",") + close;
}

From source file:com.redhat.red.build.koji.model.converter.StringListConverter.java

@Override
public Object render(List<String> value) {
    if (value == null) {
        return null;
    }//from w  w  w . j  a  v  a2 s  .  co  m
    return StringUtils.join(value, " ");
}

From source file:name.richardson.james.bukkit.utilities.command.argument.JoinedPositionalArgument.java

@Override
public String getString() {
    String value = null;/*from  www . ja  v  a  2  s . c o m*/
    if (!getStrings().isEmpty()) {
        value = StringUtils.join(getStrings(), " ");
    }
    return value;
}

From source file:jp.go.nict.langrid.p2pgridbasis.data.RequiredAttributeNotFoundException.java

public RequiredAttributeNotFoundException(String[] names) {
    super("required parameters not set:" + StringUtils.join(names, ","));
}

From source file:com.codebutler.farebot.transit.Trip.java

public static String formatStationNames(Trip trip) {
    List<String> stationText = new ArrayList<String>();
    if (trip.getStartStationName() != null)
        stationText.add(trip.getStartStationName());
    if (trip.getEndStationName() != null && (!trip.getEndStationName().equals(trip.getStartStationName())))
        stationText.add(trip.getEndStationName());

    if (stationText.size() > 0) {
        return StringUtils.join(stationText, "  ");
    } else {//from   w w w .  j  a  v a  2 s.  c om
        return null;
    }
}

From source file:info.archinnov.achilles.entity.parsing.EntityExplorer.java

public List<Class<?>> discoverEntities(List<String> packageNames) throws ClassNotFoundException, IOException {
    log.debug("Discovery of Achilles entity classes in packages {}", StringUtils.join(packageNames, ","));

    Set<Class<?>> candidateClasses = new HashSet<Class<?>>();
    Reflections reflections = new Reflections(packageNames);
    candidateClasses.addAll(reflections.getTypesAnnotatedWith(Entity.class));
    return new ArrayList<Class<?>>(candidateClasses);
}

From source file:com.redhat.red.build.koji.it.GetAllPermissionsIT.java

@Test
public void getTestUserInfo() throws Exception {
    KojiClient client = newKojiClient();
    KojiSessionInfo session = client.login();
    Set<KojiPermission> permissions = client.getAllPermissions(session);
    System.out.println(StringUtils.join(permissions, "\n"));
}