congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ObjectNode.putArray
Code IndexAdd Tabnine to your IDE (free)

How to use
putArray
method
in
org.codehaus.jackson.node.ObjectNode

Best Java code snippets using org.codehaus.jackson.node.ObjectNode.putArray (Showing top 20 results out of 315)

origin: org.codehaus.jackson/jackson-mapper-asl

@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
{
  // [JACKSON-684]: serialize as index?
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_ENUMS_USING_INDEX)) {
    return createSchemaNode("integer", true);
  }
  ObjectNode objectNode = createSchemaNode("string", true);
  if (typeHint != null) {
    JavaType type = provider.constructType(typeHint);
    if (type.isEnumType()) {
      ArrayNode enumNode = objectNode.putArray("enum");
      for (SerializedString value : _values.values()) {
        enumNode.add(value.getValue());
      }
    }
  }
  return objectNode;
}
origin: camunda/camunda-bpm-platform

@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
{
  // [JACKSON-684]: serialize as index?
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_ENUMS_USING_INDEX)) {
    return createSchemaNode("integer", true);
  }
  ObjectNode objectNode = createSchemaNode("string", true);
  if (typeHint != null) {
    JavaType type = provider.constructType(typeHint);
    if (type.isEnumType()) {
      ArrayNode enumNode = objectNode.putArray("enum");
      for (SerializedString value : _values.values()) {
        enumNode.add(value.getValue());
      }
    }
  }
  return objectNode;
}
origin: net.sf.sido/sido

@Override
protected void createArray(JsonNode e, String pName, List<JsonNode> elements) {
  ArrayNode array = ((ObjectNode) e).putArray(pName);
  for (JsonNode objectNode : elements) {
    array.add(objectNode);
  }
}
origin: NGDATA/hbase-indexer

private void setStringArrayProperty(ObjectNode node, String property, String[] strings) {
  if (strings != null) {
    ArrayNode arrayNode = node.putArray(property);
    for (String string : strings) {
      arrayNode.add(string);
    }
    node.put(property, arrayNode);
  }
}
origin: com.ngdata/hbase-indexer-model

private void setStringArrayProperty(ObjectNode node, String property, String[] strings) {
  if (strings != null) {
    ArrayNode arrayNode = node.putArray(property);
    for (String string : strings) {
      arrayNode.add(string);
    }
    node.put(property, arrayNode);
  }
}
origin: NGDATA/lilyproject

public byte[] toBytes() {
  ObjectNode node = JsonNodeFactory.instance.objectNode();
  node.put("default", defaultAccess);
  ArrayNode limitsNode = node.putArray("limits");
  for (Entry<String, Long> limit : limits.entrySet()) {
    ObjectNode limitNode = limitsNode.addObject();
    limitNode.put("store", limit.getKey());
    limitNode.put("limit", limit.getValue());
  }
  return JsonFormat.serializeAsBytesSoft(node, "BlobStoreAccessConfig");
}
origin: eBay/YiDB

@SuppressWarnings("rawtypes")
private void addJsonNode(ObjectNode jsonNode, String key, Object value) {
  if (value instanceof Integer) {
    jsonNode.put(key, (Integer) value);
  } else if (value instanceof String) {
    jsonNode.put(key, (String) value);
  } else if (value instanceof Long) {
    jsonNode.put(key, (Long) value);
  } else if (value instanceof List) {
    ArrayNode arrayNode = jsonNode.putArray(key);
    addListNode(arrayNode, (List) value);
  } else {
    jsonNode.put(key, String.valueOf(value));
  }
}
origin: apache/helix

@GET
@Path("{instanceName}/healthreports")
public Response getHealthReportsOnInstance(@PathParam("clusterId") String clusterId,
  @PathParam("instanceName") String instanceName) throws IOException {
 HelixDataAccessor accessor = getDataAccssor(clusterId);
 ObjectNode root = JsonNodeFactory.instance.objectNode();
 root.put(Properties.id.name(), instanceName);
 ArrayNode healthReportsNode = root.putArray(InstanceProperties.healthreports.name());
 List<String> healthReports =
   accessor.getChildNames(accessor.keyBuilder().healthReports(instanceName));
 if (healthReports != null && healthReports.size() > 0) {
  healthReportsNode.addAll((ArrayNode) OBJECT_MAPPER.valueToTree(healthReports));
 }
 return JSONRepresentation(root);
}
origin: apache/helix

@GET
@Path("{instanceName}/resources")
public Response getResourcesOnInstance(@PathParam("clusterId") String clusterId,
  @PathParam("instanceName") String instanceName) throws IOException {
 HelixDataAccessor accessor = getDataAccssor(clusterId);
 ObjectNode root = JsonNodeFactory.instance.objectNode();
 root.put(Properties.id.name(), instanceName);
 ArrayNode resourcesNode = root.putArray(InstanceProperties.resources.name());
 List<String> sessionIds = accessor.getChildNames(accessor.keyBuilder().sessions(instanceName));
 if (sessionIds == null || sessionIds.size() == 0) {
  return null;
 }
 // Only get resource list from current session id
 String currentSessionId = sessionIds.get(0);
 List<String> resources =
   accessor.getChildNames(accessor.keyBuilder().currentStates(instanceName, currentSessionId));
 if (resources != null && resources.size() > 0) {
  resourcesNode.addAll((ArrayNode) OBJECT_MAPPER.valueToTree(resources));
 }
 return JSONRepresentation(root);
}
origin: org.codehaus.jackson/com.springsource.org.codehaus.jackson.mapper

@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
  throws JsonMappingException
{
  ObjectNode objectNode = createSchemaNode("string", true);
  if (typeHint != null) {
    JavaType type = TypeFactory.type(typeHint);
    if (type.isEnumType()) {
      ArrayNode enumNode = objectNode.putArray("enum");
      for (String value : _values.values()) {
        enumNode.add(value);
      }
    }
  }
  return objectNode;
}
origin: apache/helix

@GET
public Response getJobs(@PathParam("clusterId") String clusterId,
  @PathParam("workflowName") String workflowName) {
 TaskDriver driver = getTaskDriver(clusterId);
 WorkflowConfig workflowConfig = driver.getWorkflowConfig(workflowName);
 ObjectNode root = JsonNodeFactory.instance.objectNode();
 if (workflowConfig == null) {
  return badRequest(String.format("Workflow %s is not found!", workflowName));
 }
 Set<String> jobs = workflowConfig.getJobDag().getAllNodes();
 root.put(Properties.id.name(), JobProperties.Jobs.name());
 ArrayNode jobsNode = root.putArray(JobProperties.Jobs.name());
 if (jobs != null) {
  jobsNode.addAll((ArrayNode) OBJECT_MAPPER.valueToTree(jobs));
 }
 return JSONRepresentation(root);
}
origin: com.barchart.wrap/barchart-wrap-jackson

@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
{
  ObjectNode objectNode = createSchemaNode("string", true);
  if (typeHint != null) {
    JavaType type = provider.constructType(typeHint);
    if (type.isEnumType()) {
      ArrayNode enumNode = objectNode.putArray("enum");
      for (SerializedString value : _values.values()) {
        enumNode.add(value.getValue());
      }
    }
  }
  return objectNode;
}
origin: apache/stanbol

private ObjectNode writeSpan(Span span) throws IOException {
  log.trace("wirte {}",span);
  ObjectNode jSpan = mapper.createObjectNode();
  jSpan.put("type", span.getType().name());
  jSpan.put("start", span.getStart());
  jSpan.put("end", span.getEnd());
  for(String key : span.getKeys()){
    List<Value<?>> values = span.getValues(key);
    if(values.size() == 1){
      jSpan.put(key, writeValue(values.get(0)));
    } else {
      ArrayNode jValues = jSpan.putArray(key);
      for(Value<?> value : values){
        jValues.add(writeValue(value));
      }
      jSpan.put(key, jValues);
    }
  }
  log.trace(" ... {}",jSpan);
  return jSpan;
}
origin: apache/helix

@GET
public Response getResources(@PathParam("clusterId") String clusterId) {
 ObjectNode root = JsonNodeFactory.instance.objectNode();
 root.put(Properties.id.name(), JsonNodeFactory.instance.textNode(clusterId));
 HelixZkClient zkClient = getHelixZkClient();
 ArrayNode idealStatesNode = root.putArray(ResourceProperties.idealStates.name());
 ArrayNode externalViewsNode = root.putArray(ResourceProperties.externalViews.name());
 List<String> idealStates = zkClient.getChildren(PropertyPathBuilder.idealState(clusterId));
 List<String> externalViews = zkClient.getChildren(PropertyPathBuilder.externalView(clusterId));
 if (idealStates != null) {
  idealStatesNode.addAll((ArrayNode) OBJECT_MAPPER.valueToTree(idealStates));
 } else {
  return notFound();
 }
 if (externalViews != null) {
  externalViewsNode.addAll((ArrayNode) OBJECT_MAPPER.valueToTree(externalViews));
 }
 return JSONRepresentation(root);
}
origin: rdelbru/SIREn

@Override
ObjectNode toJson() {
 final ObjectNode obj = mapper.createObjectNode();
 final ArrayNode bool = obj.putArray(BooleanPropertyParser.BOOLEAN_PROPERTY);
 for (final QueryClause clause : clauses) {
  final ObjectNode e = bool.addObject();
  e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
  e.putAll(clause.getQuery().toJson());
 }
 return obj;
}
origin: org.codehaus.jackson/jackson-mapper-lgpl

@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
{
  // [JACKSON-684]: serialize as index?
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_ENUMS_USING_INDEX)) {
    return createSchemaNode("integer", true);
  }
  ObjectNode objectNode = createSchemaNode("string", true);
  if (typeHint != null) {
    JavaType type = provider.constructType(typeHint);
    if (type.isEnumType()) {
      ArrayNode enumNode = objectNode.putArray("enum");
      for (SerializedString value : _values.values()) {
        enumNode.add(value.getValue());
      }
    }
  }
  return objectNode;
}
origin: NGDATA/lilyproject

@Override
public ObjectNode toJson(RecordFilterList filter, Namespaces namespaces, LRepository repository,
    RecordFilterJsonConverter<RecordFilter> converter)
    throws RepositoryException, InterruptedException {
  ObjectNode node = JsonFormat.OBJECT_MAPPER.createObjectNode();
  if (filter.getOperator() != null) {
    node.put("operator", filter.getOperator().toString());
  }
  if (filter.getFilters() != null) {
    ArrayNode filters = node.putArray("filters");
    for (RecordFilter subFilter : filter.getFilters()) {
      filters.add(converter.toJson(subFilter, namespaces, repository, converter));
    }
  }
  return node;
}
origin: rdelbru/SIREn

@Override
ObjectNode toJson() {
 final ObjectNode obj = mapper.createObjectNode();
 final ObjectNode node = obj.putObject(NodePropertyParser.NODE_PROPERTY);
 node.put(QueryPropertyParser.QUERY_PROPERTY, booleanExpression);
 if (this.hasLevel()) {
  node.put(LevelPropertyParser.LEVEL_PROPERTY, this.getLevel());
 }
 if (this.hasRange()) {
  final ArrayNode array = node.putArray(RangePropertyParser.RANGE_PROPERTY);
  array.add(this.getLowerBound());
  array.add(this.getUpperBound());
 }
 if (this.hasBoost()) {
  node.put(BoostPropertyParser.BOOST_PROPERTY, this.getBoost());
 }
 return obj;
}
origin: sirensolutions/siren

@Override
public ObjectNode toJson() {
 final ObjectNode obj = mapper.createObjectNode();
 final ObjectNode node = obj.putObject(NodePropertyParser.NODE_PROPERTY);
 node.put(QueryPropertyParser.QUERY_PROPERTY, booleanExpression);
 if (this.hasLevel()) {
  node.put(LevelPropertyParser.LEVEL_PROPERTY, this.getLevel());
 }
 if (this.hasRange()) {
  final ArrayNode array = node.putArray(RangePropertyParser.RANGE_PROPERTY);
  array.add(this.getLowerBound());
  array.add(this.getUpperBound());
 }
 if (this.hasBoost()) {
  node.put(BoostPropertyParser.BOOST_PROPERTY, this.getBoost());
 }
 return obj;
}
origin: io.hops/hadoop-mapreduce-client-app

@Private
public JsonNode countersToJSON(Counters counters) {
 ArrayNode nodes = FACTORY.arrayNode();
 if (counters != null) {
  for (CounterGroup counterGroup : counters) {
   ObjectNode groupNode = nodes.addObject();
   groupNode.put("NAME", counterGroup.getName());
   groupNode.put("DISPLAY_NAME", counterGroup.getDisplayName());
   ArrayNode countersNode = groupNode.putArray("COUNTERS");
   for (Counter counter : counterGroup) {
    ObjectNode counterNode = countersNode.addObject();
    counterNode.put("NAME", counter.getName());
    counterNode.put("DISPLAY_NAME", counter.getDisplayName());
    counterNode.put("VALUE", counter.getValue());
   }
  }
 }
 return nodes;
}
org.codehaus.jackson.nodeObjectNodeputArray

Javadoc

Method that will construct an ArrayNode and add it as a field of this ObjectNode, replacing old value, if any.

Popular methods of ObjectNode

  • put
    Method for setting value of a field to specified binary value
  • get
  • getFields
    Method to use for accessing all fields (with both names and values) of this JSON Object.
  • toString
  • has
  • remove
    Method for removing specified field properties out of this ObjectNode.
  • objectNode
  • size
  • <init>
  • arrayNode
  • putObject
    Method that will construct an ObjectNode and add it as a field of this ObjectNode, replacing old val
  • nullNode
  • putObject,
  • nullNode,
  • path,
  • putNull,
  • POJONode,
  • _put,
  • binaryNode,
  • booleanNode,
  • equals

Popular in Java

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now