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

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

Introduction

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

Prototype

public static String repeat(final char ch, final int repeat) 

Source Link

Document

<p>Returns padding using the specified delimiter repeated to a given length.</p> <pre> StringUtils.repeat('e', 0) = "" StringUtils.repeat('e', 3) = "eee" StringUtils.repeat('e', -2) = "" </pre> <p>Note: this method doesn't not support padding with <a href="http://www.unicode.org/glossary/#supplementary_character">Unicode Supplementary Characters</a> as they require a pair of char s to be represented.

Usage

From source file:com.wrmsr.wava.util.Indenter.java

public Indenter indent(int levels) {
    checkArgument(level + levels >= 0);
    level += levels;
    prefix = StringUtils.repeat(indent, level);
    return this;
}

From source file:com.aestasit.markdown.visitors.BaseVisitor.java

protected void logNode(Node node) {
    LOG.debug(StringUtils.repeat(" ", level) + node.toString());
}

From source file:com.book.identification.dao.CategoryDAOHibernate.java

public Category retrieveCategory(String categoryName, String... parentCategoryName) {
    Query query;//from w ww  .j a  va2s .co  m
    if (parentCategoryName == null) {
        query = getSession()
                .createQuery("Select c From Category c Where c.category = :categoryName AND c.parent is null")
                .setParameter("categoryName", categoryName);
    } else {
        StringBuilder stringQuery = new StringBuilder();
        stringQuery.append("Select c From Category c Where c.category = :categoryName");
        for (int i = 0; i < parentCategoryName.length; i++) {
            stringQuery.append(
                    " AND c." + StringUtils.repeat("parent.", i + 1) + "category = :parentCategoryName" + i);
        }
        stringQuery.append(
                " AND c.parent" + StringUtils.repeat(".parent", parentCategoryName.length) + " is null");

        query = getSession().createQuery(stringQuery.toString()).setParameter("categoryName", categoryName);
        for (int i = parentCategoryName.length; i > 0; i--) {
            query = query.setParameter("parentCategoryName" + (parentCategoryName.length - i),
                    StringUtils.trim(parentCategoryName[i - 1]));
        }
    }
    return (Category) query.uniqueResult();
}

From source file:de.drippinger.serviceExtractor.pojo.RunParameter.java

public void printParameter() {
    log.info("Database: {}", database);
    log.info("Database User: {}", databaseUser);
    log.info("Database Password: {}", StringUtils.repeat("*", databasePassword.length()));
    log.info("Path to Flows: {}", pathToFlows);
}

From source file:at.beris.virtualfile.filter.TestFilterHelper.java

public static List<File> createFiles(String rootDir) throws Exception {
    List<File> fileList = new ArrayList<>();
    String dataString = "0123456789ABCDEF";

    List<FileData> fileDataList = new ArrayList<>();
    fileDataList.add(new FileData(rootDir, 0, new FileAttribute[] { PosixFilePermission.OWNER_READ,
            PosixFilePermission.OWNER_WRITE, PosixFilePermission.OWNER_EXECUTE }));
    fileDataList.add(new FileData(rootDir + "testfile1.txt", 640, PosixFilePermission.OWNER_READ,
            PosixFilePermission.OWNER_WRITE, PosixFilePermission.OTHERS_READ));
    fileDataList.add(new FileData(rootDir + "testfile2.txt", 800, PosixFilePermission.OWNER_READ,
            PosixFilePermission.OWNER_WRITE, PosixFilePermission.OWNER_EXECUTE,
            PosixFilePermission.GROUP_READ));
    fileDataList.add(/*from  www  .  ja  va 2  s.co  m*/
            new FileData(rootDir + "subdir/", 0, new PosixFilePermission[] { PosixFilePermission.OWNER_READ,
                    PosixFilePermission.OWNER_WRITE, PosixFilePermission.OWNER_EXECUTE }));
    fileDataList.add(new FileData(rootDir + "subdir/goodmovie.avi", 3200, PosixFilePermission.OWNER_READ,
            PosixFilePermission.OWNER_WRITE, PosixFilePermission.OWNER_EXECUTE, PosixFilePermission.GROUP_READ,
            PosixFilePermission.GROUP_EXECUTE));

    for (FileData fileData : fileDataList) {
        File file = FileManager.newLocalFile(fileData.name);
        try {

            file.create();
            file.setAttributes(fileData.attributes);
            if (!file.isDirectory()) {
                Files.write(new java.io.File(file.getUrl().toURI()).toPath(),
                        StringUtils.repeat(dataString, fileData.size / dataString.length()).getBytes());
            }
            file.refresh();
            fileList.add(file);
        } catch (AccessDeniedException e) {
            LOGGER.warn("Permission denied - " + file.toString());
        }
    }

    return fileList;
}

From source file:com.streamsets.pipeline.stage.lib.kinesis.KinesisTestUtil.java

public static List<com.amazonaws.services.kinesis.model.Record> getConsumerTestRecords(int i) {
    List<com.amazonaws.services.kinesis.model.Record> records = new ArrayList<>(i);

    for (int j = 0; j < i; j++) {
        com.amazonaws.services.kinesis.model.Record record = new com.amazonaws.services.kinesis.model.Record()
                .withData(ByteBuffer.wrap(String.format("{\"seq\": %s}", j).getBytes()))
                .withPartitionKey(StringUtils.repeat("0", 19)).withSequenceNumber(String.valueOf(j))
                .withApproximateArrivalTimestamp(Calendar.getInstance().getTime());
        records.add(new UserRecord(record));
    }/*from  w w  w .jav  a2  s .  c om*/

    return records;
}

From source file:fi.hsl.parkandride.core.service.UserServiceTest.java

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    userService = new UserService(userRepository,
            new AuthenticationService(userRepository, passwordEncryptor,
                    StringUtils.repeat('x', AuthenticationService.SECRET_MIN_LENGTH), Period.seconds(60),
                    Period.days(60), Period.days(14)),
            new ValidationService());
}

From source file:com.bellman.bible.service.format.osistohtml.taghandler.LHandler.java

public LHandler(OsisToHtmlParameters parameters, HtmlTextWriter writer) {
    this.parameters = parameters;
    this.writer = writer;
    int indentCharCount = parameters.getIndentDepth();
    indent_html = StringUtils.repeat(HTML.NBSP, indentCharCount);
}

From source file:com.blackducksoftware.integration.hub.detect.help.print.HelpTextWriter.java

public void printSeperator() {
    println(StringUtils.repeat('_', 175));
}

From source file:forge.game.cost.CostAddMana.java

@Override
public final String toString() {
    final StringBuilder sb = new StringBuilder();
    final Integer i = this.convertAmount();
    sb.append("Add ").append(StringUtils.repeat("{" + this.getType() + "}", i)).append(" to your mana pool");
    return sb.toString();
}