com.damnhandy.uri.template.UriTemplateComponent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of handy-uri-templates Show documentation
Show all versions of handy-uri-templates Show documentation
Handy URI Templates is a RFC6570 compliant URI template processor. The library allows clients to
utilize templatized URIs and inject replacement variables to expand the template into a URI. The library sports
a fluent API, ability to plugin custom object renderers, and supports all levels of URI templates.
The newest version!
/*
*
*
*/
package com.damnhandy.uri.template;
import java.io.Serializable;
import java.util.regex.Pattern;
/**
* A Component.
*
* @author Ryan J. McDonough
* @version $Revision: 1.1 $
*/
public abstract class UriTemplateComponent implements Serializable
{
/** The serialVersionUID */
private static final long serialVersionUID = -3653287624355221784L;
/**
*
*/
private final int startPosition;
public UriTemplateComponent(final int startPoistion)
{
this.startPosition = startPoistion;
}
public abstract String getValue();
/**
* Get the startPosition of the component within the template string.
*
* @return the startPosition.
*/
public int getStartPosition()
{
return startPosition;
}
/**
* Returns a string that contains a regular expression that matches the
* URI template expression.
*
* @return
*/
public abstract Pattern getMatchPattern();
/**
* Get the endPosition.
*
* @return the endPosition.
*/
public int getEndPosition()
{
return startPosition + getValue().length();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy