org.ektorp.support
Class DesignDocument

java.lang.Object
  extended by org.ektorp.support.CouchDbDocument
      extended by org.ektorp.support.DesignDocument
All Implemented Interfaces:
java.io.Serializable

public class DesignDocument
extends CouchDbDocument

Representation of a CouchDb design document. Design documents can contain fields currently not handled by Ektorp, such as update handlers and validators. These fields are store in the unknownFields map and are accessible by the method getField(String key) However, if write such a document back to the database, these fields will be lost as they wont get serialized by Jackson. Unknown fields will be preserved if document is saved as a map instead. the method asMap() will produce a map representation. db.update(designDoc.asMap());

Author:
henrik lundgren
See Also:
Serialized Form

Nested Class Summary
static class DesignDocument.View
          Definition of a view in a design document.
 
Field Summary
static java.lang.String ID_PREFIX
           
 
Constructor Summary
DesignDocument()
           
DesignDocument(java.lang.String id)
           
 
Method Summary
 void addView(java.lang.String name, DesignDocument.View v)
           
 java.util.Map<java.lang.String,java.lang.Object> asMap()
          Makes a Map representation of this document.
 boolean containsView(java.lang.String name)
           
 DesignDocument.View get(java.lang.String viewName)
           
 java.lang.Object getField(java.lang.String key)
           
 java.util.Map<java.lang.String,DesignDocument.View> getViews()
           
 void setUnknown(java.lang.String key, java.lang.Object value)
          As design documents can contain a lot of fields currently not handled by Ektorp, a generic setter for these fields is required.
 
Methods inherited from class org.ektorp.support.CouchDbDocument
addInlineAttachment, getAttachments, getId, getRevision, isNew, removeAttachment, setId, setRevision
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_PREFIX

public static java.lang.String ID_PREFIX
Constructor Detail

DesignDocument

public DesignDocument()

DesignDocument

public DesignDocument(java.lang.String id)
Method Detail

getViews

public java.util.Map<java.lang.String,DesignDocument.View> getViews()

containsView

public boolean containsView(java.lang.String name)

get

public DesignDocument.View get(java.lang.String viewName)

addView

public void addView(java.lang.String name,
                    DesignDocument.View v)

setUnknown

public void setUnknown(java.lang.String key,
                       java.lang.Object value)
As design documents can contain a lot of fields currently not handled by Ektorp, a generic setter for these fields is required. Used for unknown properties.

Parameters:
key -
value -

asMap

public java.util.Map<java.lang.String,java.lang.Object> asMap()
Makes a Map representation of this document. Suitable to use when saving to the database, as any unknown fields otherwise will be lost.

Returns:

getField

public java.lang.Object getField(java.lang.String key)


Copyright © 2010. All Rights Reserved.