Example usage for java.util Objects toString

List of usage examples for java.util Objects toString

Introduction

In this page you can find the example usage for java.util Objects toString.

Prototype

public static String toString(Object o) 

Source Link

Document

Returns the result of calling toString for a non- null argument and "null" for a null argument.

Usage

From source file:cn.codepub.redis.directory.io.InputOutputStream.java

default void checkTransactionResult(List<Object> exec) {
    for (Object o : exec) {
        boolean equals = StringUtils.equals(Objects.toString(o), "0");
        if (equals) {
            System.err.println("Execute transaction occurs error!");
        }/*www .  j av  a  2  s  .  c  om*/
    }
}

From source file:com.norconex.collector.core.data.store.impl.jdbc.AbstractJDBCDataStoreFactory.java

@Override
public ICrawlDataStore createCrawlDataStore(ICrawlerConfig config, boolean resume) {
    Database db = database;//from   www  . j  a va 2 s . c  o m
    if (db == null) {
        db = DEFAULT_DATABASE;
    }
    String storeDir = config.getWorkDir().getPath() + "/crawlstore/" + Objects.toString(db).toLowerCase() + "/"
            + FileUtil.toSafeFileName(config.getId()) + "/";
    return new JDBCCrawlDataStore(db, storeDir, resume, createJDBCSerializer());
}

From source file:org.terasoluna.gfw.functionaltest.app.el.ElListOfSimpleValueDefaultTrimController.java

@RequestMapping(value = "6_16/search", method = RequestMethod.GET)
public String nestedJavaBeanQueryString(ListForm listForm, @PageableDefault Pageable pageable, Model model) {

    // Create Dummy Data
    List<String> dummyList = new ArrayList<String>();
    for (int i = 1; i <= 10; i++) {
        dummyList.add("Dummy");
    }//w  ww .  j  av a  2  s  .co  m

    Page<String> dummyPage = new PageImpl<String>(dummyList, pageable, 100);
    model.addAttribute("page", dummyPage);

    String listA0String = Objects.toString(listForm.getListA().get(0));
    String listA1String = Objects.toString(listForm.getListA().get(1));
    String listA2String = Objects.toString(listForm.getListA().get(2));
    String listBString = Objects.toString(listForm.getListB());
    String listCString = Objects.toString(listForm.getListC());

    model.addAttribute("listA0String", listA0String);
    model.addAttribute("listA1String", listA1String);
    model.addAttribute("listA2String", listA2String);
    model.addAttribute("listBString", listBString);
    model.addAttribute("listCString", listCString);

    String listA0StringItem = Objects.toString(listForm.getItem().getListA().get(0));
    String listA1StringItem = Objects.toString(listForm.getItem().getListA().get(1));
    String listA2StringItem = Objects.toString(listForm.getItem().getListA().get(2));
    String listBStringItem = Objects.toString(listForm.getItem().getListB());
    String listCStringItem = Objects.toString(listForm.getItem().getListC());

    model.addAttribute("listA0StringItem", listA0StringItem);
    model.addAttribute("listA1StringItem", listA1StringItem);
    model.addAttribute("listA2StringItem", listA2StringItem);
    model.addAttribute("listBStringItem", listBStringItem);
    model.addAttribute("listCStringItem", listCStringItem);

    return "el/listOfSimpleValueDefaultTrimQueryOutput";
}

From source file:de.jfachwert.bank.GeldbetragFormatter.java

/**
 * Wandelt den Text in einen {@link Geldbetrag} um.
 *
 * @param text Text, z.B. "2,50 EUR"//from   w w  w  . jav a 2 s  . co m
 * @return Geldbetrag (niemals {@code null})
 * @throws MonetaryParseException falls der Text kein Geldbetrag darstellt
 */
@Override
public Geldbetrag parse(CharSequence text) throws MonetaryParseException {
    return parse(Objects.toString(text));
}

From source file:org.kitodo.filemanagement.locking.LockManagement.java

private static GrantedAccess tryCast(LockResult lockingResult) throws AccessDeniedException {
    if (!(lockingResult instanceof GrantedAccess)) {
        throw new AccessDeniedException(UNSUITABLE_LOCKING_RESULT + Objects.toString(lockingResult));
    }/*from  w w w.j  a va2s  . c om*/
    return (GrantedAccess) lockingResult;
}

From source file:org.terasoluna.gfw.functionaltest.app.el.ElMapOfSimpleValueDefaultTrimController.java

@RequestMapping(value = "6_17/search", method = RequestMethod.GET)
public String nestedJavaBeanQueryString(MapForm mapForm, @PageableDefault Pageable pageable, Model model) {

    // Create Dummy Data
    List<String> dummyList = new ArrayList<String>();
    for (int i = 1; i <= 10; i++) {
        dummyList.add("Dummy");
    }//from w ww .  j  av  a2s.com

    Page<String> dummyPage = new PageImpl<String>(dummyList, pageable, 100);
    model.addAttribute("page", dummyPage);

    String mapA0String = Objects.toString(mapForm.getMapA().get("a"));
    String mapA1String = Objects.toString(mapForm.getMapA().get("b"));
    String mapA2String = Objects.toString(mapForm.getMapA().get("c"));

    model.addAttribute("mapA0String", mapA0String);
    model.addAttribute("mapA1String", mapA1String);
    model.addAttribute("mapA2String", mapA2String);

    String mapA0StringItem = Objects.toString(mapForm.getItem().getMapA().get("d"));
    String mapA1StringItem = Objects.toString(mapForm.getItem().getMapA().get("e"));
    String mapA2StringItem = Objects.toString(mapForm.getItem().getMapA().get("f"));

    model.addAttribute("mapA0StringItem", mapA0StringItem);
    model.addAttribute("mapA1StringItem", mapA1StringItem);
    model.addAttribute("mapA2StringItem", mapA2StringItem);

    return "el/mapOfSimpleValueDefaultTrimQueryOutput";
}

From source file:net.modelbased.proasense.storage.writer.RandomEventGenerator.java

public PredictedEvent generatePredictedEvent(String collectionId) {
    // Define complex value
    ComplexValue value = new ComplexValue();
    value.setValue(Objects.toString(randomNumber.nextLong()));
    value.setType(VariableType.LONG);/*from  www .java 2 s .  c  o m*/

    // Define properties
    Map<String, ComplexValue> properties = new HashMap<String, ComplexValue>();
    properties.put("value", value);

    // Define params
    List<Double> params = new ArrayList<Double>();
    params.add(randomNumber.nextDouble());
    params.add(randomNumber.nextDouble());

    // Define timestamps
    List<Long> timestamps = new ArrayList<Long>();
    timestamps.add(System.currentTimeMillis());
    timestamps.add(System.currentTimeMillis());

    // Define predicted event
    PredictedEvent event = new PredictedEvent();
    event.setTimestamp(System.currentTimeMillis());
    event.setPdfType(PDFType.EXPONENTIAL);
    event.setEventProperties(properties);
    event.setParams(params);
    event.setTimestamps(timestamps);
    event.setEventName(randomData.nextHexString(10));

    return event;
}

From source file:org.zaproxy.admin.VerifyCoreZapVersionsEntries.java

private static List<Element> elements(Path zapVersionsFile) throws Exception {
    List<Element> elements = new ArrayList<>();
    new ZapXmlConfiguration(zapVersionsFile.toFile()).configurationAt("core").getRootNode()
            .visit(new ConfigurationNodeVisitor() {

                @Override//from   w ww  . j a  va 2s.com
                public void visitBeforeChildren(ConfigurationNode node) {
                    elements.add(Element.of(getHierarchicalName(node), Objects.toString(node.getValue())));
                }

                @Override
                public void visitAfterChildren(ConfigurationNode node) {
                    // Nothing to do.
                }

                @Override
                public boolean terminate() {
                    return false;
                }
            });

    return elements;
}

From source file:de.jcup.egradle.core.util.History.java

public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("History (");
    sb.append(list.size());/*from ww w.ja va 2s  .  c om*/
    sb.append('/');
    sb.append(max);
    sb.append("):\n");
    int i = 0;
    for (T data : list) {
        sb.append(i);
        sb.append('=');
        sb.append(StringUtils.abbreviate(Objects.toString(data), 40));
        sb.append("\n");
    }
    return sb.toString();
}

From source file:io.tsdb.opentsdb.realtime.RollupPublisher.java

public Deferred<Object> publishDataPoint(final String metric, final long timestamp, final double value,
        final Map<String, String> tags, final byte[] tsuid) {
    LOG.trace("Storing Datapoint: " + metric + " " + timestamp + " " + value);
    IncomingDataPoint dp = makeDatapoint(metric + "." + Objects.toString(this.minutes) + "m-avg", timestamp,
            value, tags);/*from w  ww  .  ja  v a  2s . c o  m*/
    storeDatapoint(dp);
    return new Deferred<Object>();
}