Example usage for com.fasterxml.jackson.databind PropertyName PropertyName

List of usage examples for com.fasterxml.jackson.databind PropertyName PropertyName

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind PropertyName PropertyName.

Prototype

public PropertyName(String paramString) 

Source Link

Usage

From source file:org.mongojack.internal.MongoAnnotationIntrospector.java

@Override
public PropertyName findNameForDeserialization(Annotated a) {

    String rawName = findPropertyName(a);
    if (rawName != null) {
        return new PropertyName(rawName);
    }//from   w  w w  .j av  a2 s .  c o m
    return null;
}

From source file:org.jongo.marshall.jackson.JongoAnnotationIntrospector.java

@Override
public PropertyName findNameForSerialization(Annotated a) {
    return hasMongoId(a) ? new PropertyName("_id") : super.findNameForSerialization(a);
}

From source file:org.jongo.marshall.jackson.JongoAnnotationIntrospector.java

@Override
public PropertyName findNameForDeserialization(Annotated a) {
    return hasMongoId(a) ? new PropertyName("_id") : super.findNameForDeserialization(a);
}

From source file:org.mongojack.internal.MongoAnnotationIntrospector.java

@Override
public PropertyName findNameForSerialization(Annotated a) {

    String rawName = findPropertyName(a);
    if (rawName != null) {
        return new PropertyName(rawName);
    }/*  w  ww  .j av  a 2s.c om*/
    return null;

}

From source file:dk.nykredit.jackson.dataformat.hal.deser.HALBeanDeserializerModifier.java

@Override
public List<BeanPropertyDefinition> updateProperties(DeserializationConfig config, BeanDescription beanDesc,
        List<BeanPropertyDefinition> propDefs) {
    Resource ann = beanDesc.getClassAnnotations().get(Resource.class);
    if (ann != null) {
        List<BeanPropertyDefinition> modified = new ArrayList<>();
        Iterator<BeanPropertyDefinition> defIt = propDefs.iterator();
        while (defIt.hasNext()) {
            BeanPropertyDefinition pbd = defIt.next();
            for (ReservedProperty rp : ReservedProperty.values()) {
                String alternateName = rp.alternateName(pbd, pbd.getName());
                if (!pbd.getName().equals(alternateName)) {
                    modified.add(pbd.withName(new PropertyName(alternateName)));
                    defIt.remove();/*from w w  w.j  a  va2  s .c o  m*/
                }
            }
        }
        propDefs.addAll(modified);
    }
    return propDefs;
}

From source file:springfox.documentation.schema.property.PojoPropertyBuilderFactory.java

/**
 * Applies to constructor//from w  ww .j a v a2 s.  c om
    new POJOPropertyBuilder(
config,
annotationIntrospector,
forSerialization,
new PropertyName(beanProperty.getName()))
 */
private POJOPropertyBuilder jackson27Instance(MapperConfig<?> config, BeanPropertyDefinition beanProperty,
        AnnotationIntrospector annotationIntrospector, boolean forSerialization) {
    try {
        Constructor<POJOPropertyBuilder> constructor = constructorWithParams(MapperConfig.class,
                AnnotationIntrospector.class, Boolean.TYPE, PropertyName.class);

        return constructor.newInstance(config, annotationIntrospector, forSerialization,
                new PropertyName(beanProperty.getName()));
    } catch (Exception e) {
        throw new InstantiationError("Unable to create an instance of POJOPropertyBuilder");
    }
}

From source file:springfox.documentation.schema.property.PojoPropertyBuilderFactory.java

/**
 * Applies to constructor/*from   w w w.j a  v a 2s.  c o  m*/
   new POJOPropertyBuilder(new PropertyName(beanProperty.getName()),  annotationIntrospector,  true);
 */
private Optional<POJOPropertyBuilder> jackson26Instance(BeanPropertyDefinition beanProperty,
        AnnotationIntrospector annotationIntrospector, boolean forSerialization) {
    try {
        Constructor<POJOPropertyBuilder> constructor = constructorWithParams(PropertyName.class,
                AnnotationIntrospector.class, Boolean.TYPE);

        return Optional.of(constructor.newInstance(new PropertyName(beanProperty.getName()),
                annotationIntrospector, forSerialization));
    } catch (Exception e) {
        LOG.debug("Unable to instantiate jackson 26 object", e);
    }
    return Optional.absent();
}