gate.jape.constraint
Class CleanStringAccessor

java.lang.Object
  extended by gate.jape.constraint.MetaPropertyAccessor
      extended by gate.jape.constraint.StringAccessor
          extended by gate.jape.constraint.CleanStringAccessor
All Implemented Interfaces:
AnnotationAccessor, Serializable

public class CleanStringAccessor
extends StringAccessor

Accessor that returns the underlying string of an annotation in a document. The string is cleaned up a bit as follows: cleanString = string.replaceAll("\\s+", " ").trim();

Version:
$Revision$
Author:
esword
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gate.jape.constraint.MetaPropertyAccessor
log
 
Constructor Summary
CleanStringAccessor()
           
 
Method Summary
 Object getKey()
          Always returns "cleanString", the name of the meta-property which this accessor provides.
 Object getValue(Annotation annot, AnnotationSet context)
          Return the cleaned up underlying string for the annotation.
 
Methods inherited from class gate.jape.constraint.MetaPropertyAccessor
equals, hashCode, setKey, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CleanStringAccessor

public CleanStringAccessor()
Method Detail

getValue

public Object getValue(Annotation annot,
                       AnnotationSet context)
Return the cleaned up underlying string for the annotation. Context must be a Document or an AnnotationSet which points to the document.

Specified by:
getValue in interface AnnotationAccessor
Overrides:
getValue in class StringAccessor
context - optional parameter with information about the context in which the annotation has meaning. Normally this would be a Document. Not all accessors will require the context information so it may be null. Some accessor implementations may throw an exception without it.
Returns:

getKey

public Object getKey()
Always returns "cleanString", the name of the meta-property which this accessor provides.

Specified by:
getKey in interface AnnotationAccessor
Overrides:
getKey in class StringAccessor
Returns: