Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectMapper


* Configures the Jackson ObjectMapper to materialize interfaces
*/
public class MaterializedBeanObjectMapperFactory implements FactoryBean<ObjectMapper> {
    @Override
    public ObjectMapper getObject() throws Exception {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new MrBeanModule());
        return mapper;
    }
View Full Code Here


            throw new RuntimeException(e);
        }
    }

    private static ObjectMapper getMapper() {
        ObjectMapper jacksonMapper = new ObjectMapper();
        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        jacksonMapper.setAnnotationIntrospector(primary);
        jacksonMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        jacksonMapper.registerModule(new MrBeanModule());
        return jacksonMapper;
    }
View Full Code Here

    Preconditions.checkNotNull(args);
    Preconditions.checkElementIndex(1,args.length);

    // Read the YAML configuration
    ObjectMapper om = new ObjectMapper(new YAMLFactory());
    FileInputStream fis;
    try {
      fis = new FileInputStream(args[1]);
      // Stream will be closed on completion
      this.configuration = om.readValue(fis, SiteConfiguration.class);
    } catch (IOException e) {
      throw new IllegalArgumentException("Cannot read external configuration from '"+args[1]+"'",e);
    }
  }
View Full Code Here

   * @return The contents as parsed by JSON
   *
   * @throws java.io.IOException If something goes wrong
   */
  public static String jsonFixture(String fixtureClasspath) throws IOException {
    ObjectMapper om = new ObjectMapper();
    return om.writeValueAsString(om.readValue(fixture(fixtureClasspath), JsonNode.class));
  }
View Full Code Here

                throw new IllegalStateException(e);
            }
        }
        log.info("Using application default timezone {}", DateTools.getApplicationTimeZone());

        final ObjectMapper objectMapper = buildObjectMapper();
        Json.setObjectMapper(objectMapper);

        final List<Module> modules = Lists.newArrayList();
        modules.add(new AbstractModule() {
            @Override
View Full Code Here

        SecurityUtils.setSecurityManager(securityManager);

    }

    private ObjectMapper buildObjectMapper() {
        return new ObjectMapper()
                .registerModules(new GuavaModule(), new JodaModule())
                .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES)
                .enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
                .disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES)
                .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
View Full Code Here

                ClientService.getInstance().findClient("-1", profileId),
                ProfileService.getInstance().findProfile(profileId), url, requestType, true);
     
        HashMap<String, Object> jqReturn = Utils.getJQGridJSON(trySelectedRequestPaths, "paths");

        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.addMixInAnnotations(Object.class, ViewFilters.GetPathFilter.class);
        String[] ignorableFieldNames = { "possibleEndpoints", "enabledEndpoints" };
        FilterProvider filters = new SimpleFilterProvider().addFilter("Filter properties from the PathController GET",
              SimpleBeanPropertyFilter.serializeAllExcept(ignorableFieldNames));
   
        ObjectWriter writer = objectMapper.writer(filters);

        return writer.writeValueAsString(jqReturn);
    }
View Full Code Here

        // sets groups
        if (groups != null) {
            pathOverrideService.setGroupsForPath(groups, pathId);
        }

        ObjectMapper objectMapper = new ObjectMapper();
        ObjectWriter writer = objectMapper.writer();

        return writer.writeValueAsString(PathOverrideService.getInstance().getPath(pathId, clientUUID, null));
    }
View Full Code Here

            "\"password\" : \"" + databaseUserPassword + "\"" +
        " }" )
        );

    String entity = response.readEntity( String.class );
    databaseUserRevision = (String) new ObjectMapper().readValue( entity, Map.class ).get( "rev" );
    response.close();

    // 2.) make the user an admin of the database
    target = client.target( serverUri + "/" + database + "/_security" );
    response = target.request().put( Entity.text(
View Full Code Here

    }
  }

  public void afterPropertiesSet() throws FatalBeanException {
    if (this.objectMapper == null) {
      this.objectMapper = new ObjectMapper();
    }

    if (this.dateFormat != null) {
      this.objectMapper.setDateFormat(this.dateFormat);
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.ObjectMapper

Copyright © 2018 www.massapicom. 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.