public class Annotation extends Object
Modifier and Type | Field and Description |
---|---|
static String |
AUTHOR_FIELD
The name of the field of this annotation author.
|
static String |
DATE_FIELD
The name of the field of this annotation serialized date.
|
protected Map<String,Object> |
fields
The values of the fields of this annotation.
|
protected String |
id
The unique identifier of this annotation, which should be unique among all the annotations on the same target.
|
static String |
ORIGINAL_SELECTION_FIELD
The name of the field of this annotation original selection.
|
static String |
SELECTION_FIELD
The name of the field of this annotation selection.
|
static String |
SELECTION_LEFT_CONTEXT_FIELD
The name of the field of this annotation selection context to the left of the annotation.
|
static String |
SELECTION_RIGHT_CONTEXT_FIELD
The name of the field of this annotation selection context to the right of the annotation.
|
static String |
STATE_FIELD
The name of the field of this annotation state.
|
static String |
TARGET_FIELD
The name of the field of this annotation's reference to the target content.
|
Constructor and Description |
---|
Annotation(String id)
Builds an annotation description for the annotation with the passed id: used for annotation updates where only a
part of the fields my need to be set.
|
Annotation(String initialSelection,
String leftContext,
String rightContext)
Builds an annotation for the passed selection in the context, used to pass an annotation to be added (which does
not have an id yet since it hasn't been stored yet).
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Object |
get(String key) |
String |
getAuthor() |
Date |
getDate() |
Set<String> |
getFieldNames() |
String |
getId() |
String |
getOriginalSelection() |
String |
getSelection() |
String |
getSelectionInContext()
Helper method to get the selection of this annotation in its context, with the context left to the left and
context right to the right.
|
String |
getSelectionLeftContext() |
String |
getSelectionRightContext() |
AnnotationState |
getState() |
int |
hashCode() |
Object |
set(String key,
Object value)
Sets / adds a value in the fields of this annotation.
|
void |
setAuthor(String author)
Sets the author of this annotation.
|
void |
setDate(Date date) |
void |
setOriginalSelection(String originalSelection) |
void |
setSelection(String selection)
Sets the selection of this annotation.
|
void |
setSelection(String selection,
String contextLeft,
String contextRight)
Sets the selection of this annotation and the context along with it.
|
void |
setState(AnnotationState state) |
String |
toString() |
public static final String SELECTION_FIELD
public static final String SELECTION_LEFT_CONTEXT_FIELD
public static final String SELECTION_RIGHT_CONTEXT_FIELD
public static final String STATE_FIELD
public static final String ORIGINAL_SELECTION_FIELD
public static final String AUTHOR_FIELD
public static final String DATE_FIELD
public static final String TARGET_FIELD
protected final String id
public Annotation(String id)
id
- the id of this annotationpublic Annotation(String initialSelection, String leftContext, String rightContext)
initialSelection
- the selected text of this annotationleftContext
- the context to the left of the selection, which makes the selection uniquely identifiable in
the content on which this annotation is added. Can be void if selection itself is uniquerightContext
- the context to the right of the selection, which makes the selection uniquely identifiable in
the content on which this annotation is added. Can be void if selection itself is uniquepublic String getAuthor()
public void setAuthor(String author)
author
- the author of this annotation.public Date getDate()
public void setDate(Date date)
date
- the serialized date to setpublic AnnotationState getState()
public void setState(AnnotationState state)
state
- to setpublic String getSelection()
public String getSelectionInContext()
public void setSelection(String selection, String contextLeft, String contextRight)
selection
- the selection of this annotationcontextLeft
- the context to the left of the annotationcontextRight
- the context to the right of the annotationpublic void setSelection(String selection)
selection
- the selection of the annotationpublic String getSelectionLeftContext()
public String getSelectionRightContext()
public String getId()
public String getOriginalSelection()
public void setOriginalSelection(String originalSelection)
originalSelection
- the originalSelection to setpublic Object get(String key)
key
- the key of the field to getpublic Object set(String key, Object value)
key
- the key of the fieldvalue
- the value to set for the fieldCopyright © 2004–2017 XWiki. All rights reserved.