本文整理了Java中org.json.simple.JSONArray.isEmpty()
方法的一些代码示例,展示了JSONArray.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONArray.isEmpty()
方法的具体详情如下:
包路径:org.json.simple.JSONArray
类名称:JSONArray
方法名:isEmpty
暂无
代码示例来源:origin: GlowstoneMC/Glowstone
if (!json.isEmpty()) {
String uuid = (String) ((JSONObject) json.get(0)).get("id");
return UuidUtils.fromFlatString(uuid);
代码示例来源:origin: pentaho/pentaho-kettle
@SuppressWarnings( "unchecked" )
private void outPutRow( Object[] rowData ) throws KettleStepException {
// We can now output an object
data.jg = new JSONObject();
data.jg.put( data.realBlocName, data.ja );
String value = data.jg.toJSONString();
if ( data.outputValue && data.outputRowMeta != null ) {
Object[] outputRowData = RowDataUtil.addValueData( rowData, data.inputRowMetaSize, value );
incrementLinesOutput();
putRow( data.outputRowMeta, outputRowData );
}
if ( data.writeToFile && !data.ja.isEmpty() ) {
// Open a file
if ( !openNewFile() ) {
throw new KettleStepException( BaseMessages.getString(
PKG, "JsonOutput.Error.OpenNewFile", buildFilename() ) );
}
// Write data to file
try {
data.writer.write( value );
} catch ( Exception e ) {
throw new KettleStepException( BaseMessages.getString( PKG, "JsonOutput.Error.Writing" ), e );
}
// Close file
closeFile();
}
// Data are safe
data.rowsAreSafe = true;
data.ja = new JSONArray();
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeHeaderExtensions(
JSONArray headerExtensions,
ColibriConferenceIQ.Channel channelIQ)
{
if ((headerExtensions != null) && !headerExtensions.isEmpty())
{
for (Object headerExtension : headerExtensions)
{
deserializeHeaderExtension((JSONObject) headerExtension, channelIQ);
}
}
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializePayloadTypes(
JSONArray payloadTypes,
ColibriConferenceIQ.Channel channelIQ)
{
if ((payloadTypes != null) && !payloadTypes.isEmpty())
{
for (Object payloadType : payloadTypes)
{
deserializePayloadType((JSONObject) payloadType, channelIQ);
}
}
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeContents(
JSONArray contents,
ColibriConferenceIQ conferenceIQ)
{
if ((contents != null) && !contents.isEmpty())
{
for (Object content : contents)
{
deserializeContent((JSONObject) content, conferenceIQ);
}
}
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeFingerprints(
JSONArray fingerprints,
IceUdpTransportPacketExtension transportIQ)
{
if ((fingerprints != null) && !fingerprints.isEmpty())
{
for (Object fingerprint : fingerprints)
{
deserializeFingerprint((JSONObject) fingerprint, transportIQ);
}
}
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeSourceGroups(
JSONArray sourceGroups,
ColibriConferenceIQ.Channel channelIQ)
{
if ((sourceGroups != null) && !sourceGroups.isEmpty())
{
for (Object sourceGroup : sourceGroups)
{
deserializeSourceGroup(sourceGroup, channelIQ);
}
}
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeChannels(
JSONArray channels,
ColibriConferenceIQ.Content contentIQ)
{
if ((channels != null) && !channels.isEmpty())
{
for (Object channel : channels)
{
deserializeChannel((JSONObject) channel, contentIQ);
}
}
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeSources(
JSONArray sources,
ColibriConferenceIQ.Channel channelIQ)
{
if ((sources != null) && !sources.isEmpty())
{
for (Object source : sources)
{
deserializeSource(source, channelIQ);
}
}
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeEndpoints(
JSONArray endpoints,
ColibriConferenceIQ conferenceIQ)
{
if ((endpoints != null) && !endpoints.isEmpty())
{
for (Object endpoint : endpoints)
{
deserializeEndpoint(
(JSONObject) endpoint,
conferenceIQ);
}
}
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeChannelBundles(
JSONArray channelBundles,
ColibriConferenceIQ conferenceIQ)
{
if ((channelBundles != null) && !channelBundles.isEmpty())
{
for (Object channelBundle : channelBundles)
{
deserializeChannelBundle(
(JSONObject) channelBundle,
conferenceIQ);
}
}
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeSctpConnections(
JSONArray sctpConnections,
ColibriConferenceIQ.Content contentIQ)
{
if ((sctpConnections != null) && !sctpConnections.isEmpty())
{
for (Object sctpConnection : sctpConnections)
{
deserializeSctpConnection(
(JSONObject) sctpConnection,
contentIQ);
}
}
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeCandidates(
JSONArray candidates,
IceUdpTransportPacketExtension transportIQ)
{
if ((candidates != null) && !candidates.isEmpty())
{
for (Object candidate : candidates)
{
deserializeCandidate(
(JSONObject) candidate,
CandidatePacketExtension.class,
transportIQ);
}
}
}
代码示例来源:origin: apache/metron
private boolean replaceKeyArray(JSONObject payload, String toKey, String[] fromKeys) {
for (String fromKey : fromKeys) {
if (payload.containsKey(fromKey)) {
JSONArray value = (JSONArray) payload.remove(fromKey);
if (value != null && !value.isEmpty()) {
payload.put(toKey, value.get(0));
_LOG.trace("[Metron] Added {} to {}", toKey, payload);
return true;
}
}
}
return false;
}
代码示例来源:origin: jitsi/jitsi-videobridge
public static void deserializeSSRCs(
JSONArray ssrcs,
ColibriConferenceIQ.Channel channelIQ)
{
if ((ssrcs != null) && !ssrcs.isEmpty())
{
for (Object ssrc : ssrcs)
{
int ssrcIQ;
try
{
ssrcIQ = deserializeSSRC(ssrc);
}
catch (NumberFormatException nfe)
{
continue;
}
channelIQ.addSSRC(ssrcIQ);
}
}
}
代码示例来源:origin: i2p/i2p.i2p
if (list == null || list.isEmpty()) {
log("No answer");
return null;
代码示例来源:origin: dboissier/jenkins-control-plugin
private List<String> getChoices(JSONArray choiceObjs) {
List<String> choices = new LinkedList<String>();
if (choiceObjs == null || choiceObjs.isEmpty()) {
return choices;
}
for (Object choiceObj : choiceObjs) {
choices.add((String) choiceObj);
}
return choices;
}
代码示例来源:origin: apache/oozie
private void addQueueMessages(JSONObject json,
List<String> queueMessages,
String queueName,
String queueValue,
String headerMessage,
String emptyMessage) {
JSONArray queueDumpArray = (JSONArray) json.get(queueName);
queueMessages.add(headerMessage);
for (Object o : queueDumpArray) {
JSONObject entry = (JSONObject) o;
if (entry.get(queueValue) != null) {
String value = (String) entry.get(queueValue);
queueMessages.add(value);
}
}
if (queueDumpArray.isEmpty()) {
queueMessages.add(emptyMessage);
}
}
代码示例来源:origin: org.geotools/gt-mbstyle
/**
* Translate "$type": the feature type we need This key may be used with the "==", "!=", "in",
* and "!in" operators. Possible values are "Point", "LineString", and "Polygon".
*
* @return
*/
public Set<SemanticType> semanticTypeIdentifiers() {
if (json == null || json.isEmpty()) {
return semanticTypeIdentifiersDefaults();
}
Set<SemanticType> semanticTypes = semanticTypeIdentifiers(json);
return semanticTypes.isEmpty() ? semanticTypeIdentifiersDefaults() : semanticTypes;
}
代码示例来源:origin: apache/oozie
public Void call() throws Exception {
URL url = createURL(RestConstants.ADMIN_TIME_ZONES_RESOURCE, Collections.EMPTY_MAP);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
assertEquals(HttpServletResponse.SC_OK, conn.getResponseCode());
assertTrue(conn.getHeaderField("content-type").startsWith(RestConstants.JSON_CONTENT_TYPE));
JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(conn.getInputStream()));
assertTrue(json.containsKey(JsonTags.AVAILABLE_TIME_ZONES));
JSONArray array = (JSONArray) json.get(JsonTags.AVAILABLE_TIME_ZONES);
assertFalse(array.isEmpty());
return null;
}
});
内容来源于网络,如有侵权,请联系作者删除!