![JAR search and dependency download from the Maven repository](/logo.png)
com.github.fge.uritemplate.vars.values.VariableValue Maven / Gradle / Ivy
package com.github.fge.uritemplate.vars.values;
import java.util.List;
import java.util.Map;
/**
* Value for one variable used for the expansion process
*/
public abstract class VariableValue
{
protected final ValueType type;
protected VariableValue(final ValueType type)
{
this.type = type;
}
/**
* Get the type for this value
*
* @return the value type
*/
public final ValueType getType()
{
return type;
}
/**
* Get a simple string for this value
*
* Only valid for string values
*
* @return the string
* @throws IllegalStateException value is not a string value
*/
public String getScalarValue()
{
throw new IllegalStateException();
}
/**
* Get a list for this value
*
* Only valid for list values
*
* @return the list
* @throws IllegalStateException value is not a list value
*/
public List getListValue()
{
throw new IllegalStateException();
}
/**
* Get a map for this value
*
* Only valid for map values
*
* @return the map
* @throws IllegalStateException value is not a map value
*/
public Map getMapValue()
{
throw new IllegalStateException();
}
/**
* Tell whether this value is empty
*
* For strings, this tells whether the string itself is empty. For lists
* and maps, this tells whether the list or map have no elements/entries.
*
*
* @return true if the value is empty
*/
public abstract boolean isEmpty();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy