java.util.Objects#toString ( )源码实例Demo

下面列出了java.util.Objects#toString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

private void saveObjectToPage(WebORPage page, RecordObject rObject) {
    WebORObject dupObj = findDuplicate(page);
    if (dupObj == null) {
        String objName = Objects.toString(rObject.getObjectname(), "Object");
        int i = 1;
        while (page.getObjectGroupByName(objName) != null) {
            objName = rObject.getObjectname() + i++;
        }
        WebORObject newObj = page.addObject(objName);
        dummyObject.clone(newObj);
        setStatus("Object Added : " + objName);
        ((DefaultTreeModel) objectTree.getModel()).nodesWereInserted(page, new int[]{page.getChildCount() - 1});
        objectTree.scrollPathToVisible(newObj.getTreePath());
    } else {
        setStatus("Object Already Present - Page : " + page.getName() + " - Object : " + dupObj.getName());
    }
}
 
源代码2 项目: sarl   文件: AbstractExpressionGenerator.java
/** Get the string representation of an operator.
 *
 * @param call the call to the operator feature.
 * @return the string representation of the operator or {@code null} if not a valid operator.
 */
protected String getOperatorSymbol(XAbstractFeatureCall call) {
	if (call != null) {
		final Resource res = call.eResource();
		if (res instanceof StorageAwareResource) {
			final boolean isLoadedFromStorage = ((StorageAwareResource) res).isLoadedFromStorage();
			if (isLoadedFromStorage) {
				final QualifiedName operator = getOperatorMapping().getOperator(
						QualifiedName.create(call.getFeature().getSimpleName()));
				return Objects.toString(operator);
			}
		}
		return call.getConcreteSyntaxFeatureName();
	}
	return null;
}
 
源代码3 项目: ditto   文件: StartStreaming.java
private StartStreaming(final StartStreamingBuilder builder) {
    streamingType = builder.streamingType;
    connectionCorrelationId = builder.connectionCorrelationId;
    authorizationContext = builder.authorizationContext;
    @Nullable final Collection<String> namespacesFromBuilder = builder.namespaces;
    namespaces = null != namespacesFromBuilder ? List.copyOf(namespacesFromBuilder) : Collections.emptyList();
    filter = Objects.toString(builder.filter, null);
    extraFields = builder.extraFields;
}
 
源代码4 项目: TencentKona-8   文件: Asserts.java
/**
 * Asserts that {@code lhs} is the same as {@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 assertSame(Object lhs, Object rhs, String msg) {
    if (lhs != rhs) {
        msg = Objects.toString(msg, "assertSame")
                + ": expected " + Objects.toString(lhs)
                + " to equal " + Objects.toString(rhs);
        fail(msg);
    }
}
 
源代码5 项目: Lottor   文件: LogUtil.java
public static void error(Logger logger, String format, Supplier<Object>... supplier) {
    if (logger.isErrorEnabled()) {
        String[] o = new String[supplier.length];
        for (int i = 0; i < supplier.length; i++) {
            o[i] = Objects.toString(supplier[i].get());
        }
        logger.info(format, o);
    }
}
 
源代码6 项目: sdmq   文件: JobOperationServiceImpl.java
@Override
public String getBucketTop1Job(String bucketName) {
    double      to   = Long.valueOf(System.currentTimeMillis() + BucketTask.TIME_OUT).doubleValue();
    Set<String> sets = redisSupport.zrangeByScore(bucketName, 0, to, 0, 1);
    if (sets != null && sets.size() > 0) {
        String jobMsgId = Objects.toString(sets.toArray()[0]);
        return jobMsgId;
    }
    return null;
}
 
源代码7 项目: es6draft   文件: Repl.java
private boolean printScriptFrames(ResourceBundle rb, PrintWriter pw, ExecutionContext cx, Throwable e, int level) {
    final String indent = Strings.repeat('\t', level);
    final int maxDepth = options.stacktraceDepth;
    MessageFormat stackFrameFormat = messageFormat(rb, "stackframe");
    int depth = 0;
    StackTraceElement[] stackTrace = StackTraces.scriptStackTrace(e);
    for (; depth < Math.min(stackTrace.length, maxDepth); ++depth) {
        StackTraceElement element = stackTrace[depth];
        String methodName = element.getMethodName();
        String fileName = element.getFileName();
        int lineNumber = element.getLineNumber();
        pw.println(indent + formatMessage(stackFrameFormat, methodName, fileName, lineNumber));
    }
    if (depth < stackTrace.length) {
        int skipped = stackTrace.length - depth;
        pw.println(indent + formatMessage(rb, "frames_omitted", skipped));
    }
    boolean hasStacktrace = depth > 0;
    if (e.getSuppressed().length > 0 && level == 1) {
        Throwable suppressed = e.getSuppressed()[0];
        String message;
        if (suppressed instanceof ScriptException) {
            message = ((ScriptException) suppressed).getMessage(cx);
        } else {
            message = Objects.toString(suppressed.getMessage(), suppressed.getClass().getSimpleName());
        }
        pw.println(indent + formatMessage(rb, "suppressed_exception", message));
        hasStacktrace |= printScriptFrames(rb, pw, cx, suppressed, level + 1);
    }
    return hasStacktrace;
}
 
源代码8 项目: java-swing-tips   文件: BasicTransferable.java
protected Object getHtmlTransferData(DataFlavor flavor) throws IOException, UnsupportedFlavorException {
  // String data = getHtmlData();
  // data = Objects.nonNull(data) ? data : "";
  String data = Objects.toString(getHtmlData(), "");
  if (String.class.equals(flavor.getRepresentationClass())) {
    return data;
  } else if (Reader.class.equals(flavor.getRepresentationClass())) {
    return new StringReader(data);
  } else if (InputStream.class.equals(flavor.getRepresentationClass())) {
    // return new StringBufferInputStream(data);
    return createInputStream(flavor, data);
  }
  throw new UnsupportedFlavorException(flavor);
}
 
源代码9 项目: jdk8u60   文件: Asserts.java
/**
 * Asserts that {@code lhs} is the same as {@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 assertSame(Object lhs, Object rhs, String msg) {
    if (lhs != rhs) {
        msg = Objects.toString(msg, "assertSame")
                + ": expected " + Objects.toString(lhs)
                + " to equal " + Objects.toString(rhs);
        throw new RuntimeException(msg);
    }
}
 
源代码10 项目: java-swing-tips   文件: MainPanel.java
private static String getInfo(JTable table) {
  TableModel model = table.getModel();
  int index = table.convertRowIndexToModel(table.getSelectedRow());
  String str = Objects.toString(model.getValueAt(index, 0));
  Integer idx = (Integer) model.getValueAt(index, 1);
  Boolean flg = (Boolean) model.getValueAt(index, 2);
  return String.format("%s, %d, %s", str, idx, flg);
}
 
源代码11 项目: n4js   文件: N4ExecutableExtensionFactory.java
@Override
public final void setInitializationData(final IConfigurationElement config, final String propertyName,
		final Object data) throws CoreException {

	if (data instanceof String) {
		clazzName = (String) data;
	} else if (data instanceof Map) {
		clazzName = Objects.toString(((Map<?, ?>) data).get(GUICE_KEY));
	}
	if (clazzName == null) {
		throw new IllegalArgumentException("Couldn't handle passed data : " + data);
	}
	this.config = config;
}
 
源代码12 项目: openhab-core   文件: SitemapSubscriptionService.java
private void applyConfig(Map<String, Object> config) {
    if (config == null) {
        return;
    }
    final String max = Objects.toString(config.get("maxSubscriptions"), null);
    if (max != null) {
        try {
            maxSubscriptions = Integer.parseInt(max);
        } catch (NumberFormatException e) {
            logger.debug("Setting 'maxSubscriptions' must be a number; value '{}' ignored.", max);
        }
    }
}
 
源代码13 项目: sarl   文件: OutParameter.java
@Override
public String toString() {
	return Objects.toString(this.value);
}
 
源代码14 项目: o2oa   文件: ActionControl.java
private void dd(CommandLine cmd) throws Exception {
	String path = Objects.toString(cmd.getOptionValue(CMD_DD), "");
	DumpData dumpData = new DumpData();
	dumpData.execute(path);
}
 
源代码15 项目: jeesuite-libs   文件: MybatisRuntimeContext.java
private static String getStringValue(String key){
	if(context.get() == null)return null;
	return Objects.toString(context.get().get(key), null);
}
 
源代码16 项目: o2oa   文件: Mapping.java
public void setProcess(String process) {
	this.process = Objects.toString(process, "");
}
 
源代码17 项目: recheck   文件: AttributeDifference.java
public String getExpectedToString() {
	return Objects.toString( expected );
}
 
源代码18 项目: Mycat2   文件: IdLiteral.java
@Override
public String toString() {
    return Objects.toString(id);
}
 
private String asString(int i) {
    return Objects.toString(i);
}
 
源代码20 项目: openjdk-jdk9   文件: Asserts.java
/**
 * Asserts that {@code lhs} is greater than {@code rhs}.
 *
 * @param <T> a type
 * @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 <T extends Comparable<T>> void assertGreaterThan(T lhs, T rhs, String msg) {
    if (!(compare(lhs, rhs, msg) > 0)) {
        msg = Objects.toString(msg, "assertGreaterThan")
                + ": expected " + Objects.toString(lhs)
                + " > " + Objects.toString(rhs);
        fail(msg);
    }
}