Example #1
0
  @SuppressWarnings({"unchecked", "rawtypes"})
  protected boolean setPropertyValue(Object parent, String name, Object value) {
    if (parent instanceof Map) {
      ((Map) parent).put(name, value);
      return true;
    }

    if (parent instanceof List) {
      for (Object element : (List) parent) {
        if (element == null) {
          continue;
        }
        setPropertyValue(element, name, value);
      }
      return true;
    }

    ObjectDeserializer derializer = parserConfig.getDeserializer(parent.getClass());

    JavaBeanDeserializer beanDerializer = null;
    if (derializer instanceof JavaBeanDeserializer) {
      beanDerializer = (JavaBeanDeserializer) derializer;
    } else if (derializer instanceof ASMJavaBeanDeserializer) {
      beanDerializer = ((ASMJavaBeanDeserializer) derializer).getInnterSerializer();
    }

    if (beanDerializer != null) {
      FieldDeserializer fieldDeserializer = beanDerializer.getFieldDeserializer(name);
      if (fieldDeserializer == null) {
        return false;
      }

      fieldDeserializer.setValue(parent, value);
      return true;
    }

    throw new UnsupportedOperationException();
  }
  public LongFieldDeserializer(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
    super(clazz, fieldInfo);

    fieldValueDeserilizer = mapping.getDeserializer(fieldInfo);
  }