de.weltraumschaf.commons.token.Token Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shell Show documentation
Show all versions of shell Show documentation
Utilities for creating more complex shell commands with subcommands. It provides easy ability to
parse the users command line input.
/*
* LICENSE
*
* "THE BEER-WARE LICENSE" (Revision 43):
* "Sven Strittmatter" <[email protected]> wrote this file.
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a non alcohol-free beer in return.
*
* Copyright (C) 2012 "Sven Strittmatter" <[email protected]>
*/
package de.weltraumschaf.commons.token;
/**
* Defines a token.
*
* @since 1.0.0
* @author Sven Strittmatter <[email protected]>
* @version $Id: $Id
*/
public interface Token {
/**
* Start position of the token.
*
* @return never {@code null}
*/
Position getPosition();
/**
* The raw string recognized by the scanner.
*
* For example a string token {@code "foo"} has the raw value {@code "foo"} in contrast
* it's typed {@link #asString() string value} will be {@code foo}.
*
*
* @return never {@code null}
*/
String getRaw();
/**
* Get the token type class.
*
* @return never {@code null}
*/
TokenType getType();
/**
* Get the boolean typed value.
*
* @return never {@code null}
*/
Boolean asBoolean();
/**
* Get the float typed value.
*
* @return never {@code null}
*/
Float asFloat();
/**
* Get the integer typed value.
*
* @return never {@code null}
*/
Integer asInteger();
/**
* Get the string typed value.
*
* @return never {@code null}
*/
String asString();
}