コード例 #1
0
  protected DeserializationContext(
      DeserializationContext src,
      DeserializationConfig config,
      JsonParser jp,
      InjectableValues injectableValues) {
    _cache = src._cache;
    _factory = src._factory;

    _config = config;
    _featureFlags = config.getDeserializationFeatures();
    _view = config.getActiveView();
    _parser = jp;
    _injectableValues = injectableValues;
  }
コード例 #2
0
 protected DateFormat getDateFormat() {
   if (_dateFormat != null) {
     return _dateFormat;
   }
   /* 24-Feb-2012, tatu: At this point, all timezone configuration
    *    should have occured, with respect to default dateformat
    *    and timezone configuration. But we still better clone
    *    an instance as formatters may be stateful.
    */
   DateFormat df = _config.getDateFormat();
   _dateFormat = df = (DateFormat) df.clone();
   return df;
 }
コード例 #3
0
 /**
  * Method deserializers can call to inform configured {@link DeserializationProblemHandler}s of an
  * unrecognized property.
  */
 public boolean handleUnknownProperty(
     JsonParser jp, JsonDeserializer<?> deser, Object instanceOrClass, String propName)
     throws IOException, JsonProcessingException {
   LinkedNode<DeserializationProblemHandler> h = _config.getProblemHandlers();
   if (h != null) {
     while (h != null) {
       // Can bail out if it's handled
       if (h.value().handleUnknownProperty(this, jp, deser, instanceOrClass, propName)) {
         return true;
       }
       h = h.next();
     }
   }
   return false;
 }
 @Override
 public List<BeanPropertyDefinition> updateProperties(
     DeserializationConfig config,
     BeanDescription beanDesc,
     List<BeanPropertyDefinition> propDefs) {
   final AnnotationIntrospector intr = config.getAnnotationIntrospector();
   int changed = 0;
   for (int i = 0, len = propDefs.size(); i < len; ++i) {
     BeanPropertyDefinition prop = propDefs.get(i);
     AnnotatedMember acc = prop.getAccessor();
     // should not be null, but just in case:
     if (acc == null) {
       continue;
     }
     // first: do we need to handle wrapping (for Lists)?
     QName wrapperName = AnnotationUtil.findWrapperName(intr, acc);
     if (wrapperName != null) {
       String localName = wrapperName.getLocalPart();
       if ((localName != null && localName.length() >= 0) && !localName.equals(prop.getName())) {
         // make copy-on-write as necessary
         if (changed == 0) {
           propDefs = new ArrayList<BeanPropertyDefinition>(propDefs);
         }
         ++changed;
         propDefs.set(i, prop.withName(localName));
         continue;
       }
     } else {
       /* If not, how about "as text" unwrapping? Such properties
        * are exposed as values of 'unnamed' fields; so one way to
        * map them is to rename property to have name ""... (and
        * hope this does not break other parts...)
        */
       Boolean b = AnnotationUtil.findIsTextAnnotation(intr, acc);
       if (b != null && b.booleanValue()) {
         // unwrapped properties will appear as 'unnamed' (empty String)
         propDefs.set(i, prop.withName(""));
         continue;
       }
     }
   }
   return propDefs;
 }
コード例 #5
0
 /**
  * Convenience method, functionally equivalent to:
  *
  * <pre>
  *  getConfig().constructType(cls);
  * </pre>
  */
 public final JavaType constructType(Class<?> cls) {
   return _config.constructType(cls);
 }
コード例 #6
0
 /**
  * Method for accessing default TimeZone to use: convenience method for
  *
  * <pre>
  *   getConfig().getTimeZone();
  * </pre>
  */
 public TimeZone getTimeZone() {
   return _config.getTimeZone();
 }
コード例 #7
0
 /**
  * Method for accessing default Locale to use: convenience method for
  *
  * <pre>
  *   getConfig().getLocale();
  * </pre>
  */
 public Locale getLocale() {
   return _config.getLocale();
 }
コード例 #8
0
 /**
  * Convenience method, functionally equivalent to:
  *
  * <pre>
  *  getConfig().getTypeFactory();
  * </pre>
  */
 public final TypeFactory getTypeFactory() {
   return _config.getTypeFactory();
 }
コード例 #9
0
 /**
  * Convenience method, functionally equivalent to:
  *
  * <pre>
  *  getConfig().getNodeFactory();
  * </pre>
  */
 public final JsonNodeFactory getNodeFactory() {
   return _config.getNodeFactory();
 }
コード例 #10
0
 /**
  * Convenience method for accessing the default Base64 encoding used for decoding base64 encoded
  * binary content. Same as calling:
  *
  * <pre>
  *  getConfig().getBase64Variant();
  * </pre>
  */
 public final Base64Variant getBase64Variant() {
   return _config.getBase64Variant();
 }
コード例 #11
0
 /**
  * Convenience method, functionally equivalent to:
  *
  * <pre>
  *  getConfig().canOverrideAccessModifiers();
  * </pre>
  */
 public final boolean canOverrideAccessModifiers() {
   return _config.canOverrideAccessModifiers();
 }
コード例 #12
0
 public final AnnotationIntrospector getAnnotationIntrospector() {
   return _config.getAnnotationIntrospector();
 }
コード例 #13
0
 public final boolean isEnabled(MapperFeature feat) {
   return _config.isEnabled(feat);
 }