org.apache.velocity.context.Context.get()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中org.apache.velocity.context.Context.get()方法的一些代码示例,展示了Context.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.get()方法的具体详情如下:
包路径:org.apache.velocity.context.Context
类名称:Context
方法名:get

Context.get介绍

[英]Gets the value corresponding to the provided key from the context.
[中]

代码示例

代码示例来源:origin: webx/citrus

@Override
public Object internalGet(String key) {
  return context.get(key);
}

代码示例来源:origin: webx/citrus

/**
   * 如果当前正在解析<code>StringLiteral</code>,则返回<code>true</code>。
   * <p>
   * 此特性需要打开velocity configuration:
   * <code>runtime.interpolate.string.literals.hack == true</code>。
   * </p>
   */
  public static boolean isInInterpolation(Context context) {
    return context.get(INTERPOLATE_KEY) instanceof Boolean;
  }
}

代码示例来源:origin: webx/citrus

/**
   * 如果当前正在解析<code>StringLiteral</code>,则返回<code>true</code>。
   * <p>
   * 此特性需要打开velocity configuration:
   * <code>runtime.interpolate.string.literals.hack == true</code>。
   * </p>
   */
  public static boolean isInInterpolation(Context context) {
    return context.get(INTERPOLATE_KEY) instanceof Boolean;
  }
}

代码示例来源:origin: webx/citrus

@Override
public Object internalGet(String key) {
  return context.get(key);
}

代码示例来源:origin: webx/citrus

private EscapeType getEscapeType(String reference) {
  // 1. 假如明确指定了#escape或#noescape,则使用之。
  EscapeType escapeType = (EscapeType) context.get(ESCAPE_TYPE_KEY);
  if (escapeType != null) {
    log.debug("{} specified for reference {}", escapeType, reference);
    return escapeType;
  }
  // 2. 假如未明确指定,则查找规则
  // 3. 假如没有规则,或规则未匹配,则使用默认值
  if (cacheReferences) {
    escapeType = referenceCache.get(reference);
  }
  if (escapeType == null) {
    escapeType = findEscapeType(reference);
    if (cacheReferences) {
      referenceCache.put(reference, escapeType);
    }
  }
  return escapeType;
}

代码示例来源:origin: webx/citrus

private EscapeType getEscapeType(String reference) {
  // 1. 假如明确指定了#escape或#noescape,则使用之。
  EscapeType escapeType = (EscapeType) context.get(ESCAPE_TYPE_KEY);
  if (escapeType != null) {
    log.debug("{} specified for reference {}", escapeType, reference);
    return escapeType;
  }
  // 2. 假如未明确指定,则查找规则
  // 3. 假如没有规则,或规则未匹配,则使用默认值
  if (cacheReferences) {
    escapeType = referenceCache.get(reference);
  }
  if (escapeType == null) {
    escapeType = findEscapeType(reference);
    if (cacheReferences) {
      referenceCache.put(reference, escapeType);
    }
  }
  return escapeType;
}

代码示例来源:origin: com.alibaba.citrus/citrus-webx-all

/**
   * 如果当前正在解析<code>StringLiteral</code>,则返回<code>true</code>。
   * <p>
   * 此特性需要打开velocity configuration:
   * <code>runtime.interpolate.string.literals.hack == true</code>。
   * </p>
   */
  public static boolean isInInterpolation(Context context) {
    return context.get(INTERPOLATE_KEY) instanceof Boolean;
  }
}

代码示例来源:origin: velocity/velocity-dep

public Object getVariableValue(Context context, String variable)
{
  return context.get(variable);
}

代码示例来源:origin: org.apache.velocity/com.springsource.org.apache.velocity

/**
 * @see org.apache.velocity.context.Context#get(java.lang.String)
 */
public Object get(String key)
{
  return context.get( key );
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.velocity

/**
 * @see org.apache.velocity.context.Context#get(java.lang.String)
 */
public Object get(String key)
{
  return context.get( key );
}

代码示例来源:origin: org.apache.velocity/velocity-engine-core

/**
 * @see org.apache.velocity.context.Context#get(java.lang.String)
 */
public Object get(String key)
{
  return context.get( key );
}

代码示例来源:origin: org.apache.velocity.tools/velocity-tools-view-jsp

/**
 * Returns the latest tag encountered.
 *
 * @param context The Velocity context.
 * @return The latest tag.
 */
public static JspTag getLatestJspTag(Context context) {
  return (JspTag) context.get(LATEST_TAG_ATTRIBUTE_NAME);
}

代码示例来源:origin: velocity/velocity-dep

public Object get(String key)
{
  return context.get( key );
}

代码示例来源:origin: com.alibaba.citrus/citrus-webx-all

@Override
public Object internalGet(String key) {
  return context.get(key);
}

代码示例来源:origin: org.apache.velocity.tools/velocity-tools-view-jsp

@Override
public Object getAttribute(String name) {
  if (name == null) {
    throw new NullPointerException("The attribute name is null");
  }
  return velocityContext.get(name);
}

代码示例来源:origin: org.apache.cayenne/cayenne-server

/**
   * Adds value to the list of bindings in the context.
   */
  protected void bind(InternalContextAdapter context, ParameterBinding binding) {

    Collection bindings = (Collection) context.getInternalUserContext().get(
        VelocitySQLTemplateProcessor.BINDINGS_LIST_KEY);

    if (bindings != null) {
      bindings.add(binding);
    }
  }
}

代码示例来源:origin: org.apache.cayenne/cayenne-server

/**
   * Adds value to the list of result columns in the context.
   */
  protected void bindResult(InternalContextAdapter context, ColumnDescriptor columnDescriptor) {

    Collection<Object> resultColumns = (Collection<Object>) context.getInternalUserContext().get(
        VelocitySQLTemplateProcessor.RESULT_COLUMNS_LIST_KEY);

    if (resultColumns != null) {
      resultColumns.add(columnDescriptor);
    }
  }
}

代码示例来源:origin: net.bpelunit/framework

public Object resolveVariable(QName arg0) {
  final String varName = arg0.getLocalPart();
  final Object varValue = templateContext.get(varName);
  if (varValue instanceof Iterable<?>) {
    if (conversionCache.get(varName) != null) {
      return conversionCache.get(varName);
    }
    NodeList nl = convertIterableToTree(varValue);
    conversionCache.put(varName, nl);
    return nl;
  }
  return varValue;
}

代码示例来源:origin: org.apache.velocity.tools/velocity-tools-generic

/**
 * Retrieves the value for the specified reference name (aka context key).
 * @param refName context key
 * @return found value, or null
 */
public Object get(Object refName)
{
  String key = String.valueOf(refName);
  if (isSafeMode() && key.indexOf('.') >= 0)
  {
    return null;
  }
  return this.context.get(key);
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

/**
   * Adds value to the list of result columns in the context.
   */
  protected void bindResult(
    InternalContextAdapter context,
    ColumnDescriptor columnDescriptor) {

    Collection resultColumns =
      (Collection) context.getInternalUserContext().get(
        SQLTemplateProcessor.RESULT_COLUMNS_LIST_KEY);

    if (resultColumns != null) {
      resultColumns.add(columnDescriptor);
    }
  }
}

相关文章

微信公众号

最新文章

更多