Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.SerializationConfig


  public JacksonMetadata(ObjectMapper mapper, Class<?> type) {

    Assert.notNull(mapper, "ObjectMapper must not be null!");
    Assert.notNull(type, "Type must not be null!");

    SerializationConfig serializationConfig = mapper.getSerializationConfig();
    JavaType javaType = serializationConfig.constructType(type);
    BeanDescription description = serializationConfig.introspect(javaType);

    this.definitions = description.findProperties();
  }
View Full Code Here



    private boolean isEnabled(JsonProvider provider, SerializationFeature feature) {
        ObjectMapper mapper = provider.locateMapper(Object.class,
                MediaType.APPLICATION_JSON_TYPE);
        SerializationConfig sConfig = mapper.getSerializationConfig();
        return sConfig.isEnabled(feature);
    }
View Full Code Here

   */
  @Bean(name = OBJECT_MAPPER)
  @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
  public ObjectMapper jackson2ObjectMapper() {
    ObjectMapper mapper = new ObjectMapper();
    SerializationConfig serializationConfig = mapper.getSerializationConfig();
    VisibilityChecker<?> visibilityChecker = serializationConfig.getDefaultVisibilityChecker();
    // Field visibility by default.
    mapper.setVisibilityChecker(visibilityChecker
        .withFieldVisibility(Visibility.ANY)
        .withGetterVisibility(Visibility.NONE)
        .withSetterVisibility(Visibility.NONE)
View Full Code Here

  }

  @Override
  public Iterable<? extends ModelProperty> propertiesForSerialization(ResolvedType resolvedType) {
    List<ModelProperty> serializationCandidates = newArrayList();
    SerializationConfig serializationConfig = objectMapper.getSerializationConfig();
    BeanDescription beanDescription = serializationConfig.introspect(TypeFactory.defaultInstance()
            .constructType(resolvedType.getErasedType()));
    Map<String, BeanPropertyDefinition> propertyLookup = Maps.uniqueIndex(beanDescription.findProperties(),
            BeanPropertyDefinitions.beanPropertyByInternalName());

    for (ResolvedField childField : fieldProvider.in(resolvedType)) {
View Full Code Here


  @Override
  public Iterable<? extends ModelProperty> propertiesForSerialization(ResolvedType resolvedType) {
    List<ModelProperty> serializationCandidates = newArrayList();
    SerializationConfig serializationConfig = objectMapper.getSerializationConfig();
    BeanDescription beanDescription = serializationConfig.introspect(TypeFactory.defaultInstance()
            .constructType(resolvedType.getErasedType()));
    Map<String, BeanPropertyDefinition> propertyLookup = uniqueIndex(beanDescription.findProperties(),
            BeanPropertyDefinitions.beanPropertyByInternalName());
    for (ResolvedMethod childProperty : accessors.in(resolvedType)) {
      if (propertyLookup.containsKey(propertyName(childProperty.getName()))) {
View Full Code Here

  }

  @Override
  public String nameForSerialization(final BeanPropertyDefinition beanProperty) {

    SerializationConfig serializationConfig = objectMapper.getSerializationConfig();

    Optional<PropertyNamingStrategy> namingStrategy
            = Optional.fromNullable(serializationConfig.getPropertyNamingStrategy());
    String newName = namingStrategy
            .transform(overTheWireName(beanProperty, serializationConfig))
            .or(beanProperty.getName());

    LOG.debug("Name '{}' renamed to '{}'", beanProperty.getName(), newName);
View Full Code Here

TOP

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

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.