com.github.fge.uritemplate.vars.specs
Class VariableSpec

java.lang.Object
  extended by com.github.fge.uritemplate.vars.specs.VariableSpec
Direct Known Subclasses:
ExplodedVariable, PrefixVariable, SimpleVariable

public abstract class VariableSpec
extends Object

A variable specifier

A template expression can have one or more variable specifiers. For instance, in {+path:3,var}, variable specifiers are path:3 and var.

This class records the name of this specifier and its modifier, if any.


Field Summary
protected  String name
           
 
Constructor Summary
protected VariableSpec(VariableSpecType type, String name)
           
 
Method Summary
abstract  boolean equals(Object obj)
           
 String getName()
          Get the name for this varspec
abstract  int getPrefixLength()
          Return the prefix length for this varspec
 VariableSpecType getType()
          Get the modifier type for this varspec
abstract  int hashCode()
           
abstract  boolean isExploded()
          Tell whether this varspec has an explode modifier
abstract  String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected final String name
Constructor Detail

VariableSpec

protected VariableSpec(VariableSpecType type,
                       String name)
Method Detail

getType

public final VariableSpecType getType()
Get the modifier type for this varspec

Returns:
the modifier type

getName

public final String getName()
Get the name for this varspec

Returns:
the name

isExploded

public abstract boolean isExploded()
Tell whether this varspec has an explode modifier

Returns:
true if an explode modifier is present

getPrefixLength

public abstract int getPrefixLength()
Return the prefix length for this varspec

Returns -1 if no prefix length is specified. Recall: valid values are integers between 0 and 10000.

Returns:
the prefix length, or -1 if no prefix modidifer

hashCode

public abstract int hashCode()
Overrides:
hashCode in class Object

equals

public abstract boolean equals(Object obj)
Overrides:
equals in class Object

toString

public abstract String toString()
Overrides:
toString in class Object