类 LiteralExpression

java.lang.Object
cn.taketoday.expression.common.LiteralExpression
所有已实现的接口:
Expression

public class LiteralExpression extends Object implements Expression
A very simple hardcoded implementation of the Expression interface that represents a string literal. It is used with CompositeStringExpression when representing a template expression which is made up of pieces - some being real expressions to be handled by an EL implementation like SpEL, and some being just textual elements.
从以下版本开始:
4.0
作者:
Andy Clement, Juergen Hoeller
  • 字段详细资料

    • literalValue

      private final String literalValue
      Fixed literal value of this expression.
  • 构造器详细资料

    • LiteralExpression

      public LiteralExpression(String literalValue)
  • 方法详细资料

    • getExpressionString

      public final String getExpressionString()
      从接口复制的说明: Expression
      Return the original string used to create this expression (unmodified).
      指定者:
      getExpressionString 在接口中 Expression
      返回:
      the original expression string
    • getValueType

      public Class<?> getValueType(EvaluationContext context)
      从接口复制的说明: Expression
      Return the most general type that can be passed to the Expression.setValue(EvaluationContext, Object) method for the given context.
      指定者:
      getValueType 在接口中 Expression
      参数:
      context - the context in which to evaluate the expression
      返回:
      the most general type of value that can be set in this context
    • getValue

      public String getValue()
      从接口复制的说明: Expression
      Evaluate this expression in the default standard context.
      指定者:
      getValue 在接口中 Expression
      返回:
      the evaluation result
    • getValue

      @Nullable public <T> T getValue(@Nullable Class<T> expectedResultType) throws EvaluationException
      从接口复制的说明: Expression
      Evaluate this expression in the default context. If the result of the evaluation does not match (and cannot be converted to) the expected result type then an exception will be thrown.
      指定者:
      getValue 在接口中 Expression
      参数:
      expectedResultType - the type the caller would like the result to be
      返回:
      the evaluation result
      抛出:
      EvaluationException - if there is a problem during evaluation
    • getValue

      public String getValue(@Nullable Object rootObject)
      从接口复制的说明: Expression
      Evaluate this expression against the specified root object.
      指定者:
      getValue 在接口中 Expression
      参数:
      rootObject - the root object against which to evaluate the expression
      返回:
      the evaluation result
    • getValue

      @Nullable public <T> T getValue(@Nullable Object rootObject, @Nullable Class<T> desiredResultType) throws EvaluationException
      从接口复制的说明: Expression
      Evaluate this expression in the default context against the specified root object. If the result of the evaluation does not match (and cannot be converted to) the expected result type then an exception will be thrown.
      指定者:
      getValue 在接口中 Expression
      参数:
      rootObject - the root object against which to evaluate the expression
      desiredResultType - the type the caller would like the result to be
      返回:
      the evaluation result
      抛出:
      EvaluationException - if there is a problem during evaluation
    • getValue

      public String getValue(EvaluationContext context)
      从接口复制的说明: Expression
      Evaluate this expression in the provided context and return the result of evaluation.
      指定者:
      getValue 在接口中 Expression
      参数:
      context - the context in which to evaluate the expression
      返回:
      the evaluation result
    • getValue

      @Nullable public <T> T getValue(EvaluationContext context, @Nullable Class<T> expectedResultType) throws EvaluationException
      从接口复制的说明: Expression
      Evaluate this expression in the provided context which can resolve references to properties, methods, types, etc. The type of the evaluation result is expected to be of a particular type, and an exception will be thrown if it is not and cannot be converted to that type.
      指定者:
      getValue 在接口中 Expression
      参数:
      context - the context in which to evaluate the expression
      expectedResultType - the type the caller would like the result to be
      返回:
      the evaluation result
      抛出:
      EvaluationException - if there is a problem during evaluation
    • getValue

      public String getValue(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException
      从接口复制的说明: Expression
      Evaluate this expression in the provided context and return the result of evaluation, but use the supplied root context as an override for any default root object specified in the context.
      指定者:
      getValue 在接口中 Expression
      参数:
      context - the context in which to evaluate the expression
      rootObject - the root object against which to evaluate the expression
      返回:
      the evaluation result
      抛出:
      EvaluationException - if there is a problem during evaluation
    • getValue

      @Nullable public <T> T getValue(EvaluationContext context, @Nullable Object rootObject, @Nullable Class<T> desiredResultType) throws EvaluationException
      从接口复制的说明: Expression
      Evaluate this expression in the provided context which can resolve references to properties, methods, types, etc. The type of the evaluation result is expected to be of a particular type, and an exception will be thrown if it is not and cannot be converted to that type.j

      The supplied root object overrides any specified in the supplied context.

      指定者:
      getValue 在接口中 Expression
      参数:
      context - the context in which to evaluate the expression
      rootObject - the root object against which to evaluate the expression
      desiredResultType - the type the caller would like the result to be
      返回:
      the evaluation result
      抛出:
      EvaluationException - if there is a problem during evaluation
    • getValueType

      public Class<?> getValueType()
      从接口复制的说明: Expression
      Return the most general type that can be passed to the Expression.setValue(EvaluationContext, Object) method using the default context.
      指定者:
      getValueType 在接口中 Expression
      返回:
      the most general type of value that can be set in this context
    • getValueType

      public Class<?> getValueType(@Nullable Object rootObject) throws EvaluationException
      从接口复制的说明: Expression
      Return the most general type that can be passed to the Expression.setValue(Object, Object) method using the default context.
      指定者:
      getValueType 在接口中 Expression
      参数:
      rootObject - the root object against which to evaluate the expression
      返回:
      the most general type of value that can be set in this context
      抛出:
      EvaluationException - if there is a problem determining the type
    • getValueType

      public Class<?> getValueType(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException
      从接口复制的说明: Expression
      Return the most general type that can be passed to the Expression.setValue(EvaluationContext, Object, Object) method for the given context.

      The supplied root object overrides any specified in the supplied context.

      指定者:
      getValueType 在接口中 Expression
      参数:
      context - the context in which to evaluate the expression
      rootObject - the root object against which to evaluate the expression
      返回:
      the most general type of value that can be set in this context
      抛出:
      EvaluationException - if there is a problem determining the type
    • getValueTypeDescriptor

      public TypeDescriptor getValueTypeDescriptor()
      从接口复制的说明: Expression
      Return a descriptor for the most general type that can be passed to one of the setValue(...) methods using the default context.
      指定者:
      getValueTypeDescriptor 在接口中 Expression
      返回:
      a type descriptor for values that can be set in this context
    • getValueTypeDescriptor

      public TypeDescriptor getValueTypeDescriptor(@Nullable Object rootObject) throws EvaluationException
      从接口复制的说明: Expression
      Return a descriptor for the most general type that can be passed to the Expression.setValue(Object, Object) method using the default context.
      指定者:
      getValueTypeDescriptor 在接口中 Expression
      参数:
      rootObject - the root object against which to evaluate the expression
      返回:
      a type descriptor for values that can be set in this context
      抛出:
      EvaluationException - if there is a problem determining the type
    • getValueTypeDescriptor

      public TypeDescriptor getValueTypeDescriptor(EvaluationContext context)
      从接口复制的说明: Expression
      Return a descriptor for the most general type that can be passed to the Expression.setValue(EvaluationContext, Object) method for the given context.
      指定者:
      getValueTypeDescriptor 在接口中 Expression
      参数:
      context - the context in which to evaluate the expression
      返回:
      a type descriptor for values that can be set in this context
    • getValueTypeDescriptor

      public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException
      从接口复制的说明: Expression
      Return a descriptor for the most general type that can be passed to the Expression.setValue(EvaluationContext, Object, Object) method for the given context.

      The supplied root object overrides any specified in the supplied context.

      指定者:
      getValueTypeDescriptor 在接口中 Expression
      参数:
      context - the context in which to evaluate the expression
      rootObject - the root object against which to evaluate the expression
      返回:
      a type descriptor for values that can be set in this context
      抛出:
      EvaluationException - if there is a problem determining the type
    • isWritable

      public boolean isWritable(@Nullable Object rootObject) throws EvaluationException
      从接口复制的说明: Expression
      Determine if this expression can be written to, i.e. setValue() can be called.
      指定者:
      isWritable 在接口中 Expression
      参数:
      rootObject - the root object against which to evaluate the expression
      返回:
      true if the expression is writable; false otherwise
      抛出:
      EvaluationException - if there is a problem determining if it is writable
    • isWritable

      public boolean isWritable(EvaluationContext context)
      从接口复制的说明: Expression
      Determine if this expression can be written to, i.e. setValue() can be called.
      指定者:
      isWritable 在接口中 Expression
      参数:
      context - the context in which the expression should be checked
      返回:
      true if the expression is writable; false otherwise
    • isWritable

      public boolean isWritable(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException
      从接口复制的说明: Expression
      Determine if this expression can be written to, i.e. setValue() can be called.

      The supplied root object overrides any specified in the supplied context.

      指定者:
      isWritable 在接口中 Expression
      参数:
      context - the context in which the expression should be checked
      rootObject - the root object against which to evaluate the expression
      返回:
      true if the expression is writable; false otherwise
      抛出:
      EvaluationException - if there is a problem determining if it is writable
    • setValue

      public void setValue(@Nullable Object rootObject, @Nullable Object value) throws EvaluationException
      从接口复制的说明: Expression
      Set this expression in the provided context to the value provided.
      指定者:
      setValue 在接口中 Expression
      参数:
      rootObject - the root object against which to evaluate the expression
      value - the new value
      抛出:
      EvaluationException - if there is a problem during evaluation
    • setValue

      public void setValue(EvaluationContext context, @Nullable Object value) throws EvaluationException
      从接口复制的说明: Expression
      Set this expression in the provided context to the value provided.
      指定者:
      setValue 在接口中 Expression
      参数:
      context - the context in which to set the value of the expression
      value - the new value
      抛出:
      EvaluationException - if there is a problem during evaluation
    • setValue

      public void setValue(EvaluationContext context, @Nullable Object rootObject, @Nullable Object value) throws EvaluationException
      从接口复制的说明: Expression
      Set this expression in the provided context to the value provided.

      The supplied root object overrides any specified in the supplied context.

      指定者:
      setValue 在接口中 Expression
      参数:
      context - the context in which to set the value of the expression
      rootObject - the root object against which to evaluate the expression
      value - the new value
      抛出:
      EvaluationException - if there is a problem during evaluation