net.exegetic.markout.patterns
Class AbstractFreeLinkPattern

java.lang.Object
  extended by net.exegetic.markout.patterns.AbstractFreeLinkPattern
All Implemented Interfaces:
FreeLinkPattern
Direct Known Subclasses:
CategoryPattern, DocPattern, ImagePattern, WikiWordPattern

public abstract class AbstractFreeLinkPattern
extends java.lang.Object
implements FreeLinkPattern

This class provides a skeletal implementation of the FreeLinkPattern interface, to minimize the effort required to implement this interface.

Author:
Nathan Winant

Field Summary
static java.lang.String RESOURCE_NAME_REGEX
           
 
Constructor Summary
AbstractFreeLinkPattern()
          Constructs an empty FreeLinkPattern.
AbstractFreeLinkPattern(java.lang.String replacementPattern)
          Constructs a FreeLinkPattern and sets the replacement pattern.
 
Method Summary
 java.lang.String getMarkdownReplacementPattern()
          Returns the replacement pattern, wrapped in Markout.
 java.lang.String getMatcherPattern()
          Returns the matcher patten.
 java.lang.String getReplacementPattern()
          Returns the replacement pattern.
 void setReplacementPattern(java.lang.String replacementPattern)
          Sets the replacement pattern.
protected  java.lang.String wrapInBrackets(java.lang.String pattern)
          Wraps a String in two pairs of escaped brackets ([[]]).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_NAME_REGEX

public static final java.lang.String RESOURCE_NAME_REGEX
See Also:
Constant Field Values
Constructor Detail

AbstractFreeLinkPattern

public AbstractFreeLinkPattern()
Constructs an empty FreeLinkPattern. For invocation by subclass constructors, typically implicit. Because declaring a no-argument constructor is like wearing a pair of pants to a funeral: you just do it.


AbstractFreeLinkPattern

public AbstractFreeLinkPattern(java.lang.String replacementPattern)
Constructs a FreeLinkPattern and sets the replacement pattern.

Parameters:
replacementPattern - Replacement pattern
Method Detail

setReplacementPattern

public void setReplacementPattern(java.lang.String replacementPattern)
Sets the replacement pattern. This is the url pattern that the value of the free link will be placed into. For example: /docs/[[RESOURCE_NAME]].html.

Specified by:
setReplacementPattern in interface FreeLinkPattern
Parameters:
replacementPattern - Replacement pattern

getMatcherPattern

public java.lang.String getMatcherPattern()
Returns the matcher patten. This is the pattern that defines this kind of free link. It is the entire pattern, including the double brackets ([[]]). This will return RESOURCE_NAME_REGEX.

Specified by:
getMatcherPattern in interface FreeLinkPattern
Returns:
Matcher pattern

getReplacementPattern

public java.lang.String getReplacementPattern()
Returns the replacement pattern. The replacement pattern as defined by the user. By default, this will return [[RESOURCE_NAME]].

Specified by:
getReplacementPattern in interface FreeLinkPattern
Returns:
Replacement pattern

getMarkdownReplacementPattern

public java.lang.String getMarkdownReplacementPattern()
Returns the replacement pattern, wrapped in Markout. This will return a link: [[[RESOURCE_NAME]]](replacementPattern)

Specified by:
getMarkdownReplacementPattern in interface FreeLinkPattern
Returns:
Replacement pattern, wrapped in Markout.

wrapInBrackets

protected java.lang.String wrapInBrackets(java.lang.String pattern)
Wraps a String in two pairs of escaped brackets ([[]]). Really just here as a convenience for the getMatcherPattern() method.



Copyright © 2007 das markout Projekt. All Rights Reserved.