com.fasterxml.jackson.databind.deser.ValueInstantiator.getValueClass()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(1083)

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

ValueInstantiator.getValueClass介绍

[英]Accessor for raw (type-erased) type of instances to create.

NOTE: since this method has not existed since beginning of Jackson 2.0 series, default implementation will just return Object.class; implementations are expected to override it with real value.
[中]用于创建原始(类型已擦除)类型实例的访问器。
注意:自从Jackson 2.0系列开始以来,这个方法就不存在了,所以默认实现只会返回[$0$];预期实现将以实际价值覆盖它。

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Method that returns description of the value type this instantiator
 * handles. Used for error messages, diagnostics.
 */
public String getValueTypeDesc() {
  Class<?> cls = getValueClass();
  if (cls == null) {
    return "UNKNOWN";
  }
  return cls.getName();
}

代码示例来源:origin: redisson/redisson

/**
 * Method to called to create value instance from JSON Array using
 * an intermediate "delegate" value to pass to createor method
 */
public Object createUsingArrayDelegate(DeserializationContext ctxt, Object delegate) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no array delegate creator specified");
}

代码示例来源:origin: redisson/redisson

public Object createFromDouble(DeserializationContext ctxt, double value) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no double/Double-argument constructor/factory method to deserialize from Number value (%s)",
      value);
}

代码示例来源:origin: redisson/redisson

/**
 * Method to called to create value instance from JSON Object using
 * an intermediate "delegate" value to pass to createor method
 */
public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no delegate creator specified");
}

代码示例来源:origin: redisson/redisson

public Object createFromInt(DeserializationContext ctxt, int value) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no int/Int-argument constructor/factory method to deserialize from Number value (%s)",
      value);
}

代码示例来源:origin: redisson/redisson

/**
 * Method called to create value instance from JSON Object when
 * instantiation arguments are passed; this is done, for example when passing information
 * specified with "Creator" annotations.
 *<p>
 * This method is called if {@link #getFromObjectArguments} returns
 * a non-empty List of arguments.
 */
public Object createFromObjectWith(DeserializationContext ctxt, Object[] args) throws IOException {
  // sanity check; shouldn't really get called if no Creator specified
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no creator with arguments specified");
}

代码示例来源:origin: redisson/redisson

public Object createFromLong(DeserializationContext ctxt, long value) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no long/Long-argument constructor/factory method to deserialize from Number value (%s)",
      value);
}

代码示例来源:origin: redisson/redisson

public Object createFromBoolean(DeserializationContext ctxt, boolean value) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no boolean/Boolean-argument constructor/factory method to deserialize from boolean value (%s)",
      value);
}

代码示例来源:origin: redisson/redisson

/**
 * Method called to create value instance from a JSON value when
 * no data needs to passed to creator (constructor, factory method);
 * typically this will call the default constructor of the value object.
 * It will only be used if more specific creator methods are not
 * applicable; hence "default".
 *<p>
 * This method is called if {@link #getFromObjectArguments} returns
 * null or empty List.
 */
public Object createUsingDefault(DeserializationContext ctxt) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no default no-arguments constructor found");
}

代码示例来源:origin: redisson/redisson

/**
 * @since 2.4 (demoted from <code>StdValueInstantiator</code>)
 */
protected Object _createFromStringFallbacks(DeserializationContext ctxt, String value)
    throws IOException
{
  /* 28-Sep-2011, tatu: Ok this is not clean at all; but since there are legacy
   *   systems that expect conversions in some cases, let's just add a minimal
   *   patch (note: same could conceivably be used for numbers too).
   */
  if (canCreateFromBoolean()) {
    String str = value.trim();
    if ("true".equals(str)) {
      return createFromBoolean(ctxt, true);
    }
    if ("false".equals(str)) {
      return createFromBoolean(ctxt, false);
    }
  }
  // also, empty Strings might be accepted as null Object...
  if (value.length() == 0) {
    if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) {
      return null;
    }
  }
  return ctxt.handleMissingInstantiator(getValueClass(), this, ctxt.getParser(),
      "no String-argument constructor/factory method to deserialize from String value ('%s')",
      value);
}

代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind

/**
 * Method that returns description of the value type this instantiator
 * handles. Used for error messages, diagnostics.
 */
public String getValueTypeDesc() {
  Class<?> cls = getValueClass();
  if (cls == null) {
    return "UNKNOWN";
  }
  return cls.getName();
}

代码示例来源:origin: Nextdoor/bender

/**
 * Method that returns description of the value type this instantiator
 * handles. Used for error messages, diagnostics.
 */
public String getValueTypeDesc() {
  Class<?> cls = getValueClass();
  if (cls == null) {
    return "UNKNOWN";
  }
  return cls.getName();
}

代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind

public Object createFromBoolean(DeserializationContext ctxt, boolean value) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no boolean/Boolean-argument constructor/factory method to deserialize from boolean value (%s)",
      value);
}

代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind

/**
 * Method to called to create value instance from JSON Object using
 * an intermediate "delegate" value to pass to createor method
 */
public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no delegate creator specified");
}

代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind

public Object createFromInt(DeserializationContext ctxt, int value) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no int/Int-argument constructor/factory method to deserialize from Number value (%s)",
      value);
}

代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind

/**
 * Method to called to create value instance from JSON Array using
 * an intermediate "delegate" value to pass to createor method
 */
public Object createUsingArrayDelegate(DeserializationContext ctxt, Object delegate) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), this, null,
      "no array delegate creator specified");
}

代码示例来源:origin: Nextdoor/bender

public Object createFromLong(DeserializationContext ctxt, long value) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), ctxt.getParser(),
      "no long/Long-argument constructor/factory method to deserialize from Number value (%s)",
      value);
}

代码示例来源:origin: Nextdoor/bender

public Object createFromInt(DeserializationContext ctxt, int value) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), ctxt.getParser(),
      "no int/Int-argument constructor/factory method to deserialize from Number value (%s)",
      value);
}

代码示例来源:origin: Nextdoor/bender

public Object createFromBoolean(DeserializationContext ctxt, boolean value) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), ctxt.getParser(),
      "no boolean/Boolean-argument constructor/factory method to deserialize from boolean value (%s)",
      value);
}

代码示例来源:origin: Nextdoor/bender

public Object createFromDouble(DeserializationContext ctxt, double value) throws IOException {
  return ctxt.handleMissingInstantiator(getValueClass(), ctxt.getParser(),
      "no double/Double-argument constructor/factory method to deserialize from Number value (%s)",
      value);
}

相关文章

微信公众号

最新文章

更多