com.thoughtworks.xstream.mapper.Mapper.isIgnoredElement()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(165)

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

Mapper.isIgnoredElement介绍

[英]Whether this name can be ignored.
[中]是否可以忽略此名称。

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

public boolean isIgnoredElement(String name) {
  return isIgnoredElementMapper.isIgnoredElement(name);
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
  final Object result = instantiateNewInstance(context);
  final Set seenProperties = new HashSet() {
    public boolean add(Object e) {
      if (!super.add(e)) {
        throw new DuplicatePropertyException(((FastField)e).getName());
      }
      return true;
    }
  };
  Class resultType = result.getClass();
  while (reader.hasMoreChildren()) {
    reader.moveDown();
    String propertyName = mapper.realMember(resultType, reader.getNodeName());
    if (mapper.shouldSerializeMember(resultType, propertyName)) {
      boolean propertyExistsInClass = beanProvider.propertyDefinedInClass(propertyName, resultType);

      if (propertyExistsInClass) {
        Class type = determineType(reader, result, propertyName);
        Object value = context.convertAnother(result, type);
        beanProvider.writeProperty(result, propertyName, value);
        seenProperties.add(new FastField(resultType, propertyName));
      } else if (!mapper.isIgnoredElement(propertyName)) {
        throw new MissingFieldException(resultType.getName(), propertyName);
      }
    }
    reader.moveUp();
  }
  return result;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream

public boolean isIgnoredElement(String name) {
  return isIgnoredElementMapper.isIgnoredElement(name);
}

代码示例来源:origin: x-stream/xstream

@Override
public boolean isIgnoredElement(final String name) {
  return isIgnoredElementMapper.isIgnoredElement(name);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

public boolean isIgnoredElement(String name) {
  return isIgnoredElementMapper.isIgnoredElement(name);
}

代码示例来源:origin: apache/servicemix-bundles

public boolean isIgnoredElement(String name) {
  return isIgnoredElementMapper.isIgnoredElement(name);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream

public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
  final Object result = instantiateNewInstance(context);
  final Set seenProperties = new HashSet() {
    public boolean add(Object e) {
      if (!super.add(e)) {
        throw new DuplicatePropertyException(((FastField)e).getName());
      }
      return true;
    }
  };
  Class resultType = result.getClass();
  while (reader.hasMoreChildren()) {
    reader.moveDown();
    String propertyName = mapper.realMember(resultType, reader.getNodeName());
    if (mapper.shouldSerializeMember(resultType, propertyName)) {
      boolean propertyExistsInClass = beanProvider.propertyDefinedInClass(propertyName, resultType);

      if (propertyExistsInClass) {
        Class type = determineType(reader, result, propertyName);
        Object value = context.convertAnother(result, type);
        beanProvider.writeProperty(result, propertyName, value);
        seenProperties.add(new FastField(resultType, propertyName));
      } else if (!mapper.isIgnoredElement(propertyName)) {
        throw new MissingFieldException(resultType.getName(), propertyName);
      }
    }
    reader.moveUp();
  }
  return result;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
  final Object result = instantiateNewInstance(context);
  final Set seenProperties = new HashSet() {
    public boolean add(Object e) {
      if (!super.add(e)) {
        throw new DuplicatePropertyException(((FastField)e).getName());
      }
      return true;
    }
  };
  Class resultType = result.getClass();
  while (reader.hasMoreChildren()) {
    reader.moveDown();
    String propertyName = mapper.realMember(resultType, reader.getNodeName());
    if (mapper.shouldSerializeMember(resultType, propertyName)) {
      boolean propertyExistsInClass = beanProvider.propertyDefinedInClass(propertyName, resultType);

      if (propertyExistsInClass) {
        Class type = determineType(reader, result, propertyName);
        Object value = context.convertAnother(result, type);
        beanProvider.writeProperty(result, propertyName, value);
        seenProperties.add(new FastField(resultType, propertyName));
      } else if (!mapper.isIgnoredElement(propertyName)) {
        throw new MissingFieldException(resultType.getName(), propertyName);
      }
    }
    reader.moveUp();
  }
  return result;
}

代码示例来源:origin: x-stream/xstream

beanProvider.writeProperty(result, propertyName, value);
  seenProperties.add(new FastField(resultType, propertyName));
} else if (!mapper.isIgnoredElement(propertyName)) {
  throw new MissingFieldException(resultType.getName(), propertyName);

代码示例来源:origin: apache/servicemix-bundles

public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
  final Object result = instantiateNewInstance(context);
  final Set seenProperties = new HashSet() {
    public boolean add(Object e) {
      if (!super.add(e)) {
        throw new DuplicatePropertyException(((FastField)e).getName());
      }
      return true;
    }
  };
  Class resultType = result.getClass();
  while (reader.hasMoreChildren()) {
    reader.moveDown();
    String propertyName = mapper.realMember(resultType, reader.getNodeName());
    if (mapper.shouldSerializeMember(resultType, propertyName)) {
      boolean propertyExistsInClass = beanProvider.propertyDefinedInClass(propertyName, resultType);

      if (propertyExistsInClass) {
        Class type = determineType(reader, result, propertyName);
        Object value = context.convertAnother(result, type);
        beanProvider.writeProperty(result, propertyName, value);
        seenProperties.add(new FastField(resultType, propertyName));
      } else if (!mapper.isIgnoredElement(propertyName)) {
        throw new MissingFieldException(resultType.getName(), propertyName);
      }
    }
    reader.moveUp();
  }
  return result;
}

相关文章