当前位置: 首页>>代码示例>>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;未经允许,请勿转载。