Package com.couchace.jackson.internal

Examples of com.couchace.jackson.internal.CustomJacksonInjectableValues


                if (rev == null) {
                    throw CouchJsonException.internalServerError("Error finalizing Entity from JSON, found entity but _rev was never found.");
                }

                // Create couchInjectables, which may include attachments.
                CustomJacksonInjectableValues inject = buildInjectableValues(getRequestFactory, entityMeta, id, rev);

                // Instantiate the entity using mapper and injectable values
                entity = objectMapper.reader(entityClass).with(inject).readValue(parser);

                // If we have an id and it's not set (may have been set via injectable)
View Full Code Here


            throw new CouchJsonException(e);
        }
    }

    protected CustomJacksonInjectableValues buildInjectableValues(GetRequestFactory getRequestFactory, EntityMeta<?> entityMeta, String documentId, String revision) {
        CustomJacksonInjectableValues inject = new CustomJacksonInjectableValues(missingInjectableResponse, couchInjectables);

        // TODO - couchInjectables should only be used if the class has any @JsonInjectable annotations
        // Add id if it's defined
        if (entityMeta.hasId() && documentId != null) {
            inject.addValue(entityMeta.getIdName(), documentId);
        }

        // Add revision if it's defined
        if (entityMeta.hasRevision() && revision != null) {
            inject.addValue(entityMeta.getRevisionName(), revision);
        }

        // Add any attachments
        if (entityMeta.hasAttachments()) {
            for (AttachmentMeta attachmentDef : entityMeta.getAttachmentMetaList()) {
                GetAttachmentResponse response = getRequestFactory.attachment(documentId, revision, attachmentDef.getAttachmentName()).execute();
                inject.addValue(attachmentDef.getAttachmentName(), response.getContent());
            }
        }
        return inject;
    }
View Full Code Here

                if (rev == null) {
                    throw CouchJsonException.internalServerError("Error finalizing Entity from JSON, found entity but _rev was never found.");
                }

                // Create couchInjectables, which may include attachments.
                CustomJacksonInjectableValues inject = buildInjectableValues(getRequestFactory, entityMeta, id, rev);

                // Instantiate the entity using mapper and injectable values
                entity = objectMapper.reader(entityClass).with(inject).readValue(parser);

                // If we have an id and it's not set (may have been set via injectable)
View Full Code Here

            throw new CouchJsonException(e);
        }
    }

    protected CustomJacksonInjectableValues buildInjectableValues(GetRequestFactory getRequestFactory, EntityMeta<?> entityMeta, String documentId, String revision) {
        CustomJacksonInjectableValues inject = new CustomJacksonInjectableValues(missingInjectableResponse, couchInjectables);

        // TODO - couchInjectables should only be used if the class has any @JsonInjectable annotations
        // Add id if it's defined
        if (entityMeta.hasId() && documentId != null) {
            inject.addValue(entityMeta.getIdName(), documentId);
        }

        // Add revision if it's defined
        if (entityMeta.hasRevision() && revision != null) {
            inject.addValue(entityMeta.getRevisionName(), revision);
        }

        // Add any attachments
        if (entityMeta.hasAttachments()) {
            for (AttachmentMeta attachmentDef : entityMeta.getAttachmentMetaList()) {
                GetAttachmentResponse response = getRequestFactory.attachment(documentId, revision, attachmentDef.getAttachmentName()).execute();
                inject.addValue(attachmentDef.getAttachmentName(), response.getContent());
            }
        }
        return inject;
    }
View Full Code Here

*/
public class DefaultObjectMapper extends ObjectMapper {

    public DefaultObjectMapper(ObjectMapper objectMapper) {
        super(objectMapper);
        init(new CustomJacksonInjectableValues(MissingInjectableResponse.RETURN_NULL));
    }
View Full Code Here

        super(objectMapper);
        init(new CustomJacksonInjectableValues(MissingInjectableResponse.RETURN_NULL));
    }

    public DefaultObjectMapper(Module... modules) {
        init(new CustomJacksonInjectableValues(MissingInjectableResponse.RETURN_NULL), modules);
    }
View Full Code Here

TOP

Related Classes of com.couchace.jackson.internal.CustomJacksonInjectableValues

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.