Class EnumLiteral

All Implemented Interfaces:
Expression, Literal, QueryObject

public final class EnumLiteral extends AbstractLiteral
Final immutable class that represents a enum expression.
Since:
1.3
Version:
$Revision: 7121 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Author:
Udai Gupta, Ralf Joachim
  • Constructor Details

    • EnumLiteral

      public EnumLiteral(String value)
      Construct enum literal for given string value. The string value has to contain the full class name of the enumeration including the name of the constant separated by dot. If an enum constant can not be found an IllegalArgumentException will be thrown.
      Parameters:
      value - String value with full name of the enum constant.
    • EnumLiteral

      public EnumLiteral(Enum<?> value)
      Construct enum literal for given enum constant.
      Parameters:
      value - Enum constant to represent by the enum literal.
  • Method Details

    • getValue

      public Enum<?> getValue()
      Get enum constant represented by this enum literal.
      Returns:
      Enum constant represented by this enum literal.
    • toString

      public StringBuilder toString(StringBuilder sb)
      Append a string representation of the object to the given StringBuilder. In general, the toString method for query objects appends a string that textually represents this object. The result should be a query string that complies to EJB QL specification as long as the query object represents a syntay element of it. It is required that all subclasses override this method. The toString method defined at class Object is overwritten and calls this method.
      Parameters:
      sb - StringBuilder to append the string representation of this object to.
      Returns:
      Same instance of StringBuilder given as parameter.