org.ektorp.support
Annotation Type View


@Target(value={METHOD,TYPE})
@Retention(value=RUNTIME)
public @interface View

Annotation for defining views embedded in repositories.

Author:
henrik lundgren

Required Element Summary
 String name
          The name of the view
 
Optional Element Summary
 String file
          Non-trivial views are best stored in a separate files.
 String map
          Map function.
 String reduce
          Reduce function.
 

Element Detail

name

public abstract String name
The name of the view

Returns:

map

public abstract String map
Map function.

Returns:
Default:
""

reduce

public abstract String reduce
Reduce function.

Returns:
Default:
""

file

public abstract String file
Non-trivial views are best stored in a separate files. By specifying the file parameter a view definition can be loaded from the classpath. The path is relative to the class annotated by this annotation. If the file complicated_view.json is in the same directory as the repository this parameter should be set to "complicated_view.json". The file must be a valid json document: { "map": "function(doc) { much javascript here }", // the reduce function is optional "reduce": "function(keys, values) { ... }" }

Returns:
Default:
""


Copyright © 2011. All Rights Reserved.