當前位置: 首頁>>代碼示例>>Java>>正文


Java Objects.toString方法代碼示例

本文整理匯總了Java中java.util.Objects.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java Objects.toString方法的具體用法?Java Objects.toString怎麽用?Java Objects.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Objects的用法示例。


在下文中一共展示了Objects.toString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initAutoSuggest

import java.util.Objects; //導入方法依賴的package包/類
private void initAutoSuggest() {
    scenarioAutoSuggest = new AutoSuggest() {

        @Override
        public void beforeSearch(String text) {
            setSearchList(Utils.asStringList(sProject.getScenarios()));
        }
    };
    testCaseAutoSuggest = new AutoSuggest() {
        @Override
        public void beforeSearch(String text) {
            clearSearchList();
            String scenario = Objects.toString(table.getValueAt(table.getSelectedRow(), 1), "");
            if (!scenario.trim().isEmpty()
                    && sProject.getScenarioByName(scenario) != null) {
                setSearchList(Utils.asStringList(sProject.getScenarioByName(scenario).getTestCases()));
            }
        }

    };
    iterationAutoSuggest = new AutoSuggest().withSearchList(getIterationList());
    browserAutoSuggest = new AutoSuggest();
    platformAutoSuggest = new AutoSuggest().withSearchList(getPlatformList());
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:25,代碼來源:TestSetAutoSuggest.java

示例2: mapHttpSourceToCsvRow

import java.util.Objects; //導入方法依賴的package包/類
public static String[] mapHttpSourceToCsvRow(HttpSource ld) {
    return new String[]{
            ld.getUrl(), ld.getName(), ld.getLanguage(), ld.getTimezone(),
            String.valueOf(ld.isEnabled()), String.valueOf(ld.isDiscoveryEnabled()),
            Objects.toString(ld.getUrlRecrawlDelayInSecs(), ""),
            Objects.toString(ld.getFeedRecrawlDelayInSecs(), ""),
            Objects.toString(ld.getSitemapRecrawlDelayInSecs(), ""),
            Utils.listToText(ld.getUrls()), Utils.listToText(ld.getFeeds()), Utils.listToText(ld.getSitemaps()),
            Utils.listToText(ld.getCategories()), Utils.listToText(ld.getAppIds()),
            Utils.listToText(ld.getUrlFilters()), Utils.listToText(ld.getUrlNormalizers()),
            Utils.listToText(ld.getTitleSelectors()),
            Utils.listToText(ld.getTextSelectors()), Utils.listToText(ld.getTextNormalizers()),
            Utils.listToText(ld.getDateSelectors()), Utils.listToText(ld.getDateRegexps()),
            Utils.listToText(ld.getDateFormats())
    };
}
 
開發者ID:tokenmill,項目名稱:crawling-framework,代碼行數:17,代碼來源:HttpSourceCSVUtils.java

示例3: Module

import java.util.Objects; //導入方法依賴的package包/類
/**
 * Creates a new named Module. The resulting Module will be defined to the
 * VM but will not read any other modules, will not have any exports setup
 * and will not be registered in the service catalog.
 */
Module(ModuleLayer layer,
       ClassLoader loader,
       ModuleDescriptor descriptor,
       URI uri)
{
    this.layer = layer;
    this.name = descriptor.name();
    this.loader = loader;
    this.descriptor = descriptor;

    // define module to VM

    boolean isOpen = descriptor.isOpen() || descriptor.isAutomatic();
    Version version = descriptor.version().orElse(null);
    String vs = Objects.toString(version, null);
    String loc = Objects.toString(uri, null);
    String[] packages = descriptor.packages().toArray(new String[0]);
    defineModule0(this, isOpen, vs, loc, packages);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:Module.java

示例4: convert

import java.util.Objects; //導入方法依賴的package包/類
public Email convert(RawData rawData) throws IOException {
    try {
        Session s = Session.getDefaultInstance(new Properties());
        MimeMessage mimeMessage = new MimeMessage(s, rawData.getContentAsStream());
        String subject = Objects.toString(mimeMessage.getSubject(), UNDEFINED);
        ContentType contentType = ContentType.fromString(mimeMessage.getContentType());
        Object messageContent = mimeMessage.getContent();

        switch (contentType) {
            case HTML:
            case PLAIN:
                return buildPlainOrHtmlEmail(rawData, subject, contentType, messageContent);
            case MULTIPART_ALTERNATIVE:
                return buildMultipartAlternativeMail(rawData, subject, (Multipart) messageContent);
            default:
                throw new IllegalStateException("Unsupported e-mail content type " + contentType.name());
        }
    } catch (MessagingException e) {
        return buildFallbackEmail(rawData);
    }
}
 
開發者ID:gessnerfl,項目名稱:fake-smtp-server,代碼行數:22,代碼來源:EmailFactory.java

示例5: appendWithSeparators

import java.util.Objects; //導入方法依賴的package包/類
public StrBuffer appendWithSeparators(final Iterator<?> it, final String separator) {
	if (it != null) {
		final String sep = Objects.toString(separator, "");
		while (it.hasNext()) {
			append(it.next());
			if (it.hasNext()) {
				append(sep);
			}
		}
	}
	return this;
}
 
開發者ID:lyrieek,項目名稱:master-basic,代碼行數:13,代碼來源:StrBuffer.java

示例6: assertFalse

import java.util.Objects; //導入方法依賴的package包/類
/**
 * Asserts that {@code value} is {@code false}.
 *
 * @param value The value assumed to be false.
 * @param msg A description of the assumption; {@code null} for a default message.
 * @throws RuntimeException if the assertion is not true.
 */
public static void assertFalse(boolean value, String msg) {
    if (value) {
        msg = Objects.toString(msg, "assertFalse")
                + ": expected false, was true";
        fail(msg);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:Asserts.java

示例7: mapHttpSourceTestToCsvRow

import java.util.Objects; //導入方法依賴的package包/類
public static String[] mapHttpSourceTestToCsvRow(HttpSourceTest httpSourceTest) {
    return new String[]{
            httpSourceTest.getUrl(), httpSourceTest.getSource(),
            BaseEncoding.base64().encode(httpSourceTest.getHtml().getBytes(Charsets.UTF_8)),
            Objects.toString(httpSourceTest.getUrlAccepted(), "false"),
            Strings.nullToEmpty(httpSourceTest.getTitle()),
            Strings.nullToEmpty(httpSourceTest.getText()),
            Strings.nullToEmpty(httpSourceTest.getDate())
    };
}
 
開發者ID:tokenmill,項目名稱:crawling-framework,代碼行數:11,代碼來源:HttpSourceTestCSVUtils.java

示例8: next

import java.util.Objects; //導入方法依賴的package包/類
@Override
public T next() {
  K k = key;
  Entry<K, V> e = entries.get(k);
  if (e == null) {
    throw new NoSuchElementException(Objects.toString(key));
  }

  nextCalled = true;
  key = e.getNextKey();
  return get(k, e);
}
 
開發者ID:kroepke,項目名稱:luna,代碼行數:13,代碼來源:TraversableHashMap.java

示例9: assertEquals

import java.util.Objects; //導入方法依賴的package包/類
/**
 * Asserts that {@code lhs} is equal to {@code rhs}.
 *
 * @param lhs The left hand side of the comparison.
 * @param rhs The right hand side of the comparison.
 * @param msg A description of the assumption; {@code null} for a default message.
 * @throws RuntimeException if the assertion is not true.
 */
public static void assertEquals(Object lhs, Object rhs, String msg) {
    if ((lhs != rhs) && ((lhs == null) || !(lhs.equals(rhs)))) {
        msg = Objects.toString(msg, "assertEquals")
                + ": expected " + Objects.toString(lhs)
                + " to equal " + Objects.toString(rhs);
        fail(msg);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:Asserts.java

示例10: toString

import java.util.Objects; //導入方法依賴的package包/類
public String toString() {
    return super.toString() + "//" + Objects.toString(obj);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:4,代碼來源:FilterUSRTest.java

示例11: getReference

import java.util.Objects; //導入方法依賴的package包/類
public String getReference() {
    return Objects.toString(stepDetails.get(HEADERS.Reference.getIndex()), "");
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:4,代碼來源:TestStep.java

示例12: getTag

import java.util.Objects; //導入方法依賴的package包/類
public String getTag() {
    return Objects.toString(stepDetails.get(HEADERS.Step.getIndex()), "");
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:4,代碼來源:TestStep.java

示例13: toString

import java.util.Objects; //導入方法依賴的package包/類
@Override
public String toString() {
    return START_PATTERN + Objects.toString(suffix, "") + SEPARATOR + Objects.toString(ext, "");
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:5,代碼來源:AppStorageDataSource.java

示例14: toPOJO

import java.util.Objects; //導入方法依賴的package包/類
/**
 * Port の POJO を作る
 */
public static PasaranPOJO toPOJO(AbstractPort port) {
    PasaranPOJO pojo = createPOJO(port);

    pojo.name = Objects.toString(AbstractPort.Attr.IFNAME.get(port), "");
    pojo.objectType = getObjectType(port);

    if (port instanceof VlanIf) {
        pojo.vlanId = VlanIf.Attr.VLAN_ID.get((VlanIf) port);
        VlanIf vlanIfMvo = (VlanIf) port;
        pojo.taggedPorts = vlanIfMvo.getCurrentTaggedPorts().stream()
                .map(p -> MvoUtil.toMvoId((MVO)p))
                .collect(Collectors.toList());
        pojo.untaggedPorts = vlanIfMvo.getCurrentUntaggedPorts().stream()
                .map(p -> MvoUtil.toMvoId((MVO)p))
                .collect(Collectors.toList());

        MvoSet<Port> aliases = AbstractPort.Attr.ALIASES.get(port);
        if (aliases != null) {
            pojo.aliases = new ArrayList<>();
            pojo.aliases.addAll(
                    aliases.get().stream()
                            .map(alias -> MvoUtil.toMvoId((MVO) alias))
                            .collect(Collectors.toList()));
            pojo.owner = MvoUtil.toMvoId((MVO) port.getOwner());
        }
    }

    if (port instanceof EthLagIf) {
        pojo.memberPorts = new ArrayList<>();
        pojo.memberPorts.addAll(
                port.getParts().stream()
                        .map(p -> MvoUtil.toMvoId((AbstractPort) p))
                        .collect(Collectors.toList()));
    }

    if (port instanceof IpIf) {
        MvoSet<Port> associatedPorts = IpIf.ASSOCIATED_PORTS.get((IpIf) port);
        if (associatedPorts != null) {
            pojo.associatedPorts =
                    associatedPorts.get().stream()
                            .map(associatedPort -> MvoUtil.toMvoId((MVO) associatedPort))
                            .collect(Collectors.toList());
        }

        MvoMap<Port, Integer> boundPorts = IpIf.Attr.BOUND_PORTS.get((IpIf) port);
        if (boundPorts != null) {
            pojo.boundPorts = boundPorts.getKeys().stream()
                    .collect(Collectors.toMap(
                            key -> MvoUtil.toMvoId((MVO) key),
                            boundPorts::get
                    ));
        }
    }

    return pojo;
}
 
開發者ID:openNaEF,項目名稱:openNaEF,代碼行數:60,代碼來源:KeseranPOJOUtil.java

示例15: nullSafeToString

import java.util.Objects; //導入方法依賴的package包/類
public static String nullSafeToString(Object object){
	return Objects.toString(object, null);
}
 
開發者ID:hotpads,項目名稱:datarouter,代碼行數:4,代碼來源:ObjectTool.java


注:本文中的java.util.Objects.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。