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 or path to function.
 String reduce
          Reduce function or path to function.
 

Element Detail

name

public abstract String name
The name of the view

Returns:

map

public abstract String map
Map function or path to function.

This value may be a string of code to use for the function. Alternatively, the string may specify a file to load for the function by starting the string with classpath:. The rest of the string then represents a relative path to the function.

Returns:
Default:
""

reduce

public abstract String reduce
Reduce function or path to function.

This value may be a string of code to use for the function. Alternatively, the string may specify a file to load for the function by starting the string with classpath:. The rest of the string then represents a relative path to the 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 © 2017. All rights reserved.