コード例 #1
0
  public <T> T getInformalParameter(String name, Class<T> type) {
    Binding binding = getBinding(name);

    Object value = binding == null ? null : binding.get();

    return elementResources.coerce(value, type);
  }
コード例 #2
0
    void write(MarkupWriter writer) {
      Object value = binding.get();

      if (value == null) return;

      if (value instanceof Block) return;

      // If it's already a String, don't use the TypeCoercer (renderInformalParameters is
      // a CPU hotspot, as is TypeCoercer.coerce).

      String valueString =
          value instanceof String ? (String) value : elementResources.coerce(value, String.class);

      writer.attributes(name, valueString);
    }