Class JavaLiteralClass<T>

Type Parameters:
T - the type of the Class value.
All Implemented Interfaces:
io.github.mmm.code.api.expression.CodeConstant, io.github.mmm.code.api.expression.CodeExpression, io.github.mmm.code.api.expression.CodeLiteral, io.github.mmm.code.api.item.CodeItem, JavaExpression

public final class JavaLiteralClass<T> extends JavaLiteral<Class<T>>
Implementation of JavaLiteral for Class literal.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Method Details

    • withValue

      public JavaLiteralClass<T> withValue(Class<T> newValue)
      Specified by:
      withValue in class JavaLiteral<Class<T>>
      Parameters:
      newValue - the new value. May not be null.
      Returns:
      the corresponding JavaConstant of the same type with the given value.
    • getJavaClass

      public Class<? extends Class<T>> getJavaClass()
      Overrides:
      getJavaClass in class JavaConstant<Class<T>>
      Returns:
      the Class reflecting the type of this constant.
    • getSourceCode

      public String getSourceCode()
      Specified by:
      getSourceCode in interface io.github.mmm.code.api.item.CodeItem
      Specified by:
      getSourceCode in class JavaConstant<Class<T>>
    • isPrimitive

      public boolean isPrimitive()
      Overrides:
      isPrimitive in class JavaLiteral<Class<T>>
      Returns:
      true if the type is primitive.
    • of

      public static <T> JavaLiteralClass<T> of(Class<T> value)
      Type Parameters:
      T - the type of the Class value.
      Parameters:
      value - the literal value. May not be null.
      Returns:
      the CodeLiteral for the given value.
    • of

      public static <T> JavaLiteralClass<T> of(Class<T> value, boolean unqualified)
      Type Parameters:
      T - the type of the Class value.
      Parameters:
      value - the literal value. May not be null.
      unqualified - - true to use the simple name, false otherwise (for qualified name).
      Returns:
      the CodeLiteral for the given value.