public String stringify ( ) { if ( type == TokenType . TEXT ) { return defaultValue ; } StringBuilder sb = new StringBuilder ( ) ; if ( type == TokenType . BEAN ) { sb . append ( BEAN_SYMBOL ) ; sb . append ( START_BRACKET ) ; if ( name != null ) { sb . append ( name ) ; } if ( value != null ) { sb . append ( VALUE_SEPARATOR ) ; sb . append ( value ) ; } if ( getterName != null ) { sb . append ( GETTER_SEPARATOR ) ; sb . append ( getterName ) ; } } else if ( type == TokenType . TEMPLATE ) { sb . append ( TEMPLATE_SYMBOL ) ; sb . append ( START_BRACKET ) ; if ( name != null ) { sb . append ( name ) ; } } else if ( type == TokenType . PARAMETER ) { sb . append ( PARAMETER_SYMBOL ) ; sb . append ( START_BRACKET ) ; if ( name != null ) { sb . append ( name ) ; } } else if ( type == TokenType . ATTRIBUTE ) { sb . append ( ATTRIBUTE_SYMBOL ) ; sb . append ( START_BRACKET ) ; if ( name != null ) { sb . append ( name ) ; } if ( getterName != null ) { sb . append ( GETTER_SEPARATOR ) ; sb . append ( getterName ) ; } } else if ( type == TokenType . PROPERTY ) { sb . append ( PROPERTY_SYMBOL ) ; sb . append ( START_BRACKET ) ; if ( name != null ) { sb . append ( name ) ; } if ( value != null ) { sb . append ( VALUE_SEPARATOR ) ; sb . append ( value ) ; } if ( getterName != null ) { sb . append ( GETTER_SEPARATOR ) ; sb . append ( getterName ) ; } } else { throw new InvalidTokenException ( "Unknown token type: " + type , this ) ; } if ( defaultValue != null ) { sb . append ( VALUE_SEPARATOR ) ; sb . append ( defaultValue ) ; } sb . append ( END_BRACKET ) ; return sb . toString ( ) ; }
Convert a Token object into a string .