Пример #1
0
 /**
  * More efficient version of {@link #narrowBy}, called by internal framework in cases where
  * compatibility checks are to be skipped.
  *
  * @since 1.5
  */
 public JavaType forcedNarrowBy(Class<?> subclass) {
   if (subclass == _class) { // can still optimize for simple case
     return this;
   }
   JavaType result = _narrow(subclass);
   // TODO: these checks should NOT actually be needed; above should suffice:
   if (_valueHandler != result.getValueHandler()) {
     result = result.withValueHandler(_valueHandler);
   }
   if (_typeHandler != result.getTypeHandler()) {
     result = result.withTypeHandler(_typeHandler);
   }
   return result;
 }
 public StdValueInstantiator(DeserializationConfig config, JavaType valueType) {
   _cfgEmptyStringsAsObjects =
       (config == null)
           ? false
           : config.isEnabled(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
   _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString();
 }
Пример #3
0
  /**
   * Method that can be called to do a "narrowing" conversions; that is, to return a type with a raw
   * class that is assignable to the raw class of this type. If this is not possible, an {@link
   * IllegalArgumentException} is thrown. If class is same as the current raw class, instance itself
   * is returned.
   */
  public JavaType narrowBy(Class<?> subclass) {
    // First: if same raw class, just return this instance
    if (subclass == _class) {
      return this;
    }
    // Otherwise, ensure compatibility
    _assertSubclass(subclass, _class);
    JavaType result = _narrow(subclass);

    // TODO: these checks should NOT actually be needed; above should suffice:
    if (_valueHandler != result.getValueHandler()) {
      result = result.withValueHandler(_valueHandler);
    }
    if (_typeHandler != result.getTypeHandler()) {
      result = result.withTypeHandler(_typeHandler);
    }
    return result;
  }
 /** @since 1.9.4 */
 public String idFromBaseType() {
   return idFromValueAndType(null, _baseType.getRawClass());
 }