本文整理了Java中org.codehaus.jackson.node.ObjectNode.size()
方法的一些代码示例,展示了ObjectNode.size()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectNode.size()
方法的具体详情如下:
包路径:org.codehaus.jackson.node.ObjectNode
类名称:ObjectNode
方法名:size
暂无
代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl
/**
* Method for adding all properties of the given Object, overriding
* any existing values for those properties.
*
* @param other Object of which properties to add to this object
*
* @return This node (to allow chaining)
*
* @since 1.3
*/
public JsonNode putAll(ObjectNode other)
{
int len = other.size();
if (len > 0) {
if (_children == null) {
_children = new LinkedHashMap<String, JsonNode>(len);
}
other.putContentsTo(_children);
}
return this;
}
代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) {
return false;
}
ObjectNode other = (ObjectNode) o;
if (other.size() != size()) {
return false;
}
if (_children != null) {
for (Map.Entry<String, JsonNode> en : _children.entrySet()) {
String key = en.getKey();
JsonNode value = en.getValue();
JsonNode otherValue = other.get(key);
if (otherValue == null || !otherValue.equals(value)) {
return false;
}
}
}
return true;
}
代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl
@Override
public String toString()
{
StringBuilder sb = new StringBuilder(32 + (size() << 4));
sb.append("{");
if (_children != null) {
int count = 0;
for (Map.Entry<String, JsonNode> en : _children.entrySet()) {
if (count > 0) {
sb.append(",");
}
++count;
TextNode.appendQuoted(sb, en.getKey());
sb.append(':');
sb.append(en.getValue().toString());
}
}
sb.append("}");
return sb.toString();
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Method for adding all properties of the given Object, overriding
* any existing values for those properties.
*
* @param other Object of which properties to add to this object
*
* @return This node (to allow chaining)
*
* @since 1.3
*/
public JsonNode putAll(ObjectNode other)
{
int len = other.size();
if (len > 0) {
if (_children == null) {
_children = new LinkedHashMap<String, JsonNode>(len);
}
other.putContentsTo(_children);
}
return this;
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public String toString()
{
StringBuilder sb = new StringBuilder(32 + (size() << 4));
sb.append("{");
if (_children != null) {
int count = 0;
for (Map.Entry<String, JsonNode> en : _children.entrySet()) {
if (count > 0) {
sb.append(",");
}
++count;
TextNode.appendQuoted(sb, en.getKey());
sb.append(':');
sb.append(en.getValue().toString());
}
}
sb.append("}");
return sb.toString();
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) {
return false;
}
ObjectNode other = (ObjectNode) o;
if (other.size() != size()) {
return false;
}
if (_children != null) {
for (Map.Entry<String, JsonNode> en : _children.entrySet()) {
String key = en.getKey();
JsonNode value = en.getValue();
JsonNode otherValue = other.get(key);
if (otherValue == null || !otherValue.equals(value)) {
return false;
}
}
}
return true;
}
代码示例来源:origin: com.barchart.wrap/barchart-wrap-jackson
/**
* Method for adding all properties of the given Object, overriding
* any existing values for those properties.
*
* @param other Object of which properties to add to this object
*
* @return This node (to allow chaining)
*
* @since 1.3
*/
public JsonNode putAll(ObjectNode other)
{
int len = other.size();
if (len > 0) {
if (_children == null) {
_children = new LinkedHashMap<String, JsonNode>(len);
}
other.putContentsTo(_children);
}
return this;
}
代码示例来源:origin: org.codehaus.jackson/jackson-mapper-lgpl
/**
* Method for adding all properties of the given Object, overriding
* any existing values for those properties.
*
* @param other Object of which properties to add to this object
*
* @return This node (to allow chaining)
*
* @since 1.3
*/
public JsonNode putAll(ObjectNode other)
{
int len = other.size();
if (len > 0) {
if (_children == null) {
_children = new LinkedHashMap<String, JsonNode>(len);
}
other.putContentsTo(_children);
}
return this;
}
代码示例来源:origin: ovea-deprecated/jetty-session-redis
/**
* Method for adding all properties of the given Object, overriding
* any existing values for those properties.
*
* @param other Object of which properties to add to this object
*
* @return This node (to allow chaining)
*
* @since 1.3
*/
public JsonNode putAll(ObjectNode other)
{
int len = other.size();
if (len > 0) {
if (_children == null) {
_children = new LinkedHashMap<String, JsonNode>(len);
}
other.putContentsTo(_children);
}
return this;
}
代码示例来源:origin: org.codehaus.jackson/jackson-mapper-lgpl
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) {
return false;
}
ObjectNode other = (ObjectNode) o;
if (other.size() != size()) {
return false;
}
if (_children != null) {
for (Map.Entry<String, JsonNode> en : _children.entrySet()) {
String key = en.getKey();
JsonNode value = en.getValue();
JsonNode otherValue = other.get(key);
if (otherValue == null || !otherValue.equals(value)) {
return false;
}
}
}
return true;
}
代码示例来源:origin: ovea-deprecated/jetty-session-redis
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) {
return false;
}
ObjectNode other = (ObjectNode) o;
if (other.size() != size()) {
return false;
}
if (_children != null) {
for (Map.Entry<String, JsonNode> en : _children.entrySet()) {
String key = en.getKey();
JsonNode value = en.getValue();
JsonNode otherValue = other.get(key);
if (otherValue == null || !otherValue.equals(value)) {
return false;
}
}
}
return true;
}
代码示例来源:origin: org.codehaus.jackson/jackson-mapper-lgpl
@Override
public String toString()
{
StringBuilder sb = new StringBuilder(32 + (size() << 4));
sb.append("{");
if (_children != null) {
int count = 0;
for (Map.Entry<String, JsonNode> en : _children.entrySet()) {
if (count > 0) {
sb.append(",");
}
++count;
TextNode.appendQuoted(sb, en.getKey());
sb.append(':');
sb.append(en.getValue().toString());
}
}
sb.append("}");
return sb.toString();
}
代码示例来源:origin: com.barchart.wrap/barchart-wrap-jackson
@Override
public String toString()
{
StringBuilder sb = new StringBuilder(32 + (size() << 4));
sb.append("{");
if (_children != null) {
int count = 0;
for (Map.Entry<String, JsonNode> en : _children.entrySet()) {
if (count > 0) {
sb.append(",");
}
++count;
TextNode.appendQuoted(sb, en.getKey());
sb.append(':');
sb.append(en.getValue().toString());
}
}
sb.append("}");
return sb.toString();
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* @param keyValues The map to turn into the string.
* @return A string of format {"key":"value",...}
*/
String getMessagesFromMap(final Map<String, String> keyValues) {
ObjectNode node = objectMapper.createObjectNode();
for (Map.Entry<String, String> entry : keyValues.entrySet()) {
node.put(entry.getKey(), entry.getValue());
}
return node.size() > 0 ? node.toString() : null;
}
代码示例来源:origin: ovea-deprecated/jetty-session-redis
@Override
public String toString()
{
StringBuilder sb = new StringBuilder(32 + (size() << 4));
sb.append("{");
if (_children != null) {
int count = 0;
for (Map.Entry<String, JsonNode> en : _children.entrySet()) {
if (count > 0) {
sb.append(",");
}
++count;
TextNode.appendQuoted(sb, en.getKey());
sb.append(':');
sb.append(en.getValue().toString());
}
}
sb.append("}");
return sb.toString();
}
代码示例来源:origin: com.ngdata/hbase-indexer-model
public UpdateIndexerInput fromJsonBytes(byte [] jsonBytes) {
ObjectNode node = null;
try {
node = (ObjectNode) new ObjectMapper().readTree(new ByteArrayInputStream(jsonBytes));
} catch (IOException e) {
throw new JsonFormatException("Error parsing indexer definition JSON.", e);
}
if (node.size() != 2) {
new JsonFormatException("Expected object field of size 2, got size " + node.size());
}
IndexerDefinition baseIndexer = getDefinitionFromNode(node,"baseIndexer").build();
IndexerDefinition newIndexer = getDefinitionFromNode(node, "newIndexer").build();
return new UpdateIndexerInput(newIndexer, baseIndexer);
}
代码示例来源:origin: eBay/YiDB
@Test
public void testProjection09() {
String query = "ApplicationService[@resourceId=~\"srp-app.*\"]{*}.accessPoints{*}";
cmsdbContext.setShowDisplayMeta(true);
cmsdbContext.setAllowFullTableScan(true);
IQueryResult result = queryService.query(query, cmsdbContext);
Assert.assertNotNull(result.getDisplayMeta());
ObjectNode apDisplay = (ObjectNode) result.getDisplayMeta().get(0).get("fields").get("accessPoints")
.get("refDataType").get("AccessPoint").get("fields");
MetaClass meta = cmsdbMetaService.getMetaClass("AccessPoint");
Assert.assertEquals(meta.getFieldNames().size(), apDisplay.size());
}
代码示例来源:origin: eBay/YiDB
@Test
public void testProject08() {
String query = "Rack{@location}.assets.asset!AssetServer{@resourceId,@faultDomain}";
cmsdbContext.setAllowFullTableScan(true);
cmsdbContext.setShowDisplayMeta(true);
IQueryResult result = queryService.query(query, cmsdbContext);
Assert.assertNotNull(result.getDisplayMeta());
Assert.assertEquals(1, result.getDisplayMeta().size());
// reverse
ObjectNode rackDisplay = (ObjectNode) result.getDisplayMeta().get(0).get("fields");
Assert.assertEquals(4, rackDisplay.size());
ObjectNode assetDisplay = (ObjectNode) rackDisplay.get("assets").get("refDataType").get("Asset").get("fields");
Assert.assertEquals(3, assetDisplay.size());
ObjectNode assetServerDisplay = (ObjectNode) assetDisplay.get("asset!AssetServer").get("refDataType")
.get("AssetServer").get("fields");
Assert.assertEquals(4, assetServerDisplay.size());
}
代码示例来源:origin: eBay/YiDB
/**
* Set query
*/
@Test
public void testProject07() {
raptorContext.setAllowFullTableScan(true);
raptorContext.setShowDisplayMeta(true);
String query = "ApplicationService.(services{@_oid}&&updateStrategies{@_type})";
IQueryResult result = queryService.query(query, raptorContext);
ArrayNode display = result.getDisplayMeta();
Assert.assertEquals(2, display.size());
ObjectNode servDisplay = (ObjectNode) display.get(0).get("fields");
Assert.assertEquals(2, servDisplay.size());
ObjectNode usDisplay = (ObjectNode) display.get(1).get("fields");
Assert.assertEquals(2, usDisplay.size());
}
代码示例来源:origin: eBay/YiDB
@Test
public void testProject06() {
// case 0 : aggregation
String query = "NetworkAddress<@healthState>{@healthState, $max(@address), $count()}";
cmsdbContext.setAllowFullTableScan(true);
cmsdbContext.setShowDisplayMeta(true);
IQueryResult result = queryService.query(query, cmsdbContext);
ArrayNode display = result.getDisplayMeta();
ObjectNode na = (ObjectNode) display.get(0).get("fields");
Assert.assertEquals(5, na.size());
Assert.assertTrue(na.has("healthState"));
Assert.assertTrue(na.has("$count"));
Assert.assertTrue(na.has("$max_address"));
}
内容来源于网络,如有侵权,请联系作者删除!