Package com.couchace.jackson.internal

Examples of com.couchace.jackson.internal.CustomInjectableValues


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

                // Create injectables, which may include attachments.
                CustomInjectableValues 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 a revision and it's not set (may have been set via injectable)
View Full Code Here


            throw new CouchJsonException(e);
        }
    }

    protected CustomInjectableValues buildInjectableValues(GetRequestFactory getRequestFactory, EntityMeta<?> entityMeta, String documentId, String revision) {
        CustomInjectableValues inject = CustomInjectableValues.newThrowExceptionOnMissing();

        // TODO - injectables should only be used if the class has any @JsonInjectable annotations
        // 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

TOP

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

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.