All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.damnhandy.uri.template.UriTemplateComponent Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.1.8
Show 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