Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.ObjectMapper.writeValueAsBytes()


                        try
                        {
                            stmt2.setString(1, configuredObject.getType());
                            if (configuredObject.getAttributes() != null)
                            {
                                byte[] attributesAsBytes = objectMapper.writeValueAsBytes(
                                        configuredObject.getAttributes());
                                ByteArrayInputStream bis = new ByteArrayInputStream(attributesAsBytes);
                                stmt2.setBinaryStream(2, bis, attributesAsBytes.length);
                            }
                            else
View Full Code Here


                                insertStmt.setNull(3, Types.BLOB);
                            }
                            else
                            {
                                final Map<String, Object> attributes = configuredObject.getAttributes();
                                byte[] attributesAsBytes = objectMapper.writeValueAsBytes(attributes);
                                ByteArrayInputStream bis = new ByteArrayInputStream(attributesAsBytes);
                                insertStmt.setBinaryStream(3, bis, attributesAsBytes.length);
                            }
                            insertStmt.execute();
                        }
View Full Code Here

            try
            {
                for(Map.Entry<UUID, Map<String,Object>> bindingEntry : bindingsToUpdate.entrySet())
                {
                    stmt.setString(1, "Binding");
                    byte[] attributesAsBytes = objectMapper.writeValueAsBytes(bindingEntry.getValue());

                    ByteArrayInputStream bis = new ByteArrayInputStream(attributesAsBytes);
                    stmt.setBinaryStream(2, bis, attributesAsBytes.length);
                    stmt.setString(3, bindingEntry.getKey().toString());
                    stmt.execute();
View Full Code Here

                        else
                        {
                            final Map<String, Object> attributes = configuredObject.getAttributes();
                            final ObjectMapper objectMapper = new ObjectMapper();
                            objectMapper.registerModule(_module);
                            byte[] attributesAsBytes = objectMapper.writeValueAsBytes(attributes);

                            ByteArrayInputStream bis = new ByteArrayInputStream(attributesAsBytes);
                            insertStmt.setBinaryStream(3, bis, attributesAsBytes.length);
                        }
                        insertStmt.execute();
View Full Code Here

                    try
                    {
                        stmt2.setString(1, configuredObject.getType());
                        if (configuredObject.getAttributes() != null)
                        {
                            byte[] attributesAsBytes = objectMapper.writeValueAsBytes(
                                    configuredObject.getAttributes());
                            ByteArrayInputStream bis = new ByteArrayInputStream(attributesAsBytes);
                            stmt2.setBinaryStream(2, bis, attributesAsBytes.length);
                        }
                        else
View Full Code Here

                            insertStmt.setNull(3, Types.BLOB);
                        }
                        else
                        {
                            final Map<String, Object> attributes = configuredObject.getAttributes();
                            byte[] attributesAsBytes = objectMapper.writeValueAsBytes(attributes);
                            ByteArrayInputStream bis = new ByteArrayInputStream(attributesAsBytes);
                            insertStmt.setBinaryStream(3, bis, attributesAsBytes.length);
                        }
                        insertStmt.execute();
                    }
View Full Code Here

        for (IndexerDefinition index : indices) {
            array.add(converter.toJson(index));
        }

        ObjectMapper objectMapper = new ObjectMapper();
        IOUtils.write(objectMapper.writeValueAsBytes(array), outputStream);
    }
}
View Full Code Here

            put.add(infoCf, emailCq, Bytes.toBytes(email));
            put.add(infoCf, ageCq, Bytes.toBytes(age));

            MyPayload payload = new MyPayload();
            payload.setPartialUpdate(false);
            put.add(infoCf, payloadCq, jsonMapper.writeValueAsBytes(payload));

            htable.put(put);
            System.out.println("Added row " + Bytes.toString(rowkey));
        }
    }
View Full Code Here

  }

  public byte[] toJson() {
    ObjectMapper objectMapper = new ObjectMapper();
    try {
      return objectMapper.writeValueAsBytes(this);
    } catch (JsonGenerationException e) {
      throw new RuntimeException(e);
    } catch (JsonMappingException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
View Full Code Here

  }

  public byte[] toJson() {
    ObjectMapper mapper = new ObjectMapper();
     try {
      return mapper.writeValueAsBytes(this);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.