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

com.damnhandy.uri.template.Literal 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.util.regex.Pattern;

/**
 * Represents the non-expression parts of a URI Template
 * 
 * @author Ryan J. McDonough
 * @version $Revision: 1.1 $
 * @since 2.0
 */
public class Literal extends UriTemplateComponent
{

   /** The serialVersionUID */
   private static final long serialVersionUID = 6011009312823496878L;

   private final String value;

   private final Pattern matchPattern;

   /**
    * Create a new Literal.
    * 
    */
   public Literal(final String value, int startPosition)
   {
      super(startPosition);
      this.value = value;
      this.matchPattern = Pattern.compile(Pattern.quote(getValue()));
   }

   @Override
   public String getValue()
   {
      return value;
   }

   @Override
   public String toString()
   {
      return value;
   }

   @Override
   public Pattern getMatchPattern()
   {
      return this.matchPattern;
   }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy