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

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

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

Mapper.realMember介绍

[英]How a serialized member representation should be mapped back to a real member.
[中]序列化成员表示应该如何映射回真实成员。

代码示例

代码示例来源:origin: jenkinsci/jenkins

public String realMember(Class type, String serialized) {
  return delegate.realMember(type, serialized);
}

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

public String realMember(Class type, String serialized) {
  return realMemberMapper.realMember(type, serialized);
}

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

@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
  final boolean oldFormat = "custom".equals(reader.getAttribute(mapper.aliasForSystemAttribute("serialization")));
  if (oldFormat) {
    reader.moveDown();
    reader.moveDown();
  }
  final Map<String, Long> elements = new HashMap<>();
  while (reader.hasMoreChildren()) {
    reader.moveDown();
    final String name = reader.getNodeName();
    elements.put(oldFormat ? name : mapper.realMember(ValueRange.class, name), Long.valueOf(reader.getValue()));
    reader.moveUp();
  }
  if (oldFormat) {
    reader.moveUp();
    reader.moveUp();
  }
  return ValueRange.of(elements.get("minSmallest").longValue(), elements.get("minLargest").longValue(), elements
    .get("maxSmallest")
    .longValue(), elements.get("maxLargest").longValue());
}

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

public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    String methodName = null;
    String declaringClassName = null;
    
    while((methodName == null || declaringClassName == null) && reader.hasMoreChildren()) {
      reader.moveDown();
      
      if (reader.getNodeName().equals("name")) {
        methodName = reader.getValue();
      } else if (reader.getNodeName().equals("clazz")) {
        declaringClassName = reader.getValue();
      }
      reader.moveUp();
    }
    
    Class declaringClass = (Class)javaClassConverter.fromString(declaringClassName);
    try {
      return declaringClass.getDeclaredField(mapper.realMember(declaringClass, methodName));
    } catch (NoSuchFieldException e) {
      throw new ConversionException(e);
    }
  }
}

代码示例来源:origin: jenkinsci/jenkins

String fieldName = mapper.realMember(result.getClass(), reader.getNodeName());
for (Class<?> concrete = result.getClass(); concrete != null; concrete = concrete.getSuperclass()) {

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

final String fieldName = mapper.realMember(resultType, attrName);
final Field field = reflectionProvider.getFieldOrNull(resultType, fieldName);
if (field != null) {

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

final String name = oldFormat
  ? reader.getNodeName()
  : mapper.realMember(WeekFields.class, reader.getNodeName());
if ("minimalDays".equals(name)) {
  minimalDays = Integer.parseInt(reader.getValue());

代码示例来源: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: com.thoughtworks.xstream/xstream

.realMember(resultType, mapper.attributeForAlias(attrAlias));
Field field = reflectionProvider.getFieldOrNull(resultType, attrName);
if (field != null && shouldUnmarshalField(field)) {
  ? resultType
  : explicitDeclaringClass;
String fieldName = mapper.realMember(fieldDeclaringClass, originalNodeName);
Mapper.ImplicitCollectionMapping implicitCollectionMapping = mapper
  .getImplicitCollectionDefForFieldName(fieldDeclaringClass, fieldName);

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

while (reader.hasMoreChildren()) {
  reader.moveDown();
  String name = mapper.realMember(currentType[0], reader.getNodeName());
  if (mapper.shouldSerializeMember(currentType[0], name)) {
String classAttribute = HierarchicalStreams.readClassAttribute(reader, mapper);

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

public void defaultReadObject() {
  if (serializationMembers.getSerializablePersistentFields(currentType[0]) != null) {
    readFieldsFromStream();
    return;
  }
  if (!reader.hasMoreChildren()) {
    return;
  }
  reader.moveDown();
  if (!reader.getNodeName().equals(ELEMENT_DEFAULT)) {
    throw new ConversionException("Expected <" + ELEMENT_DEFAULT + "/> element in readObject() stream");
  }
  while (reader.hasMoreChildren()) {
    reader.moveDown();
    String fieldName = mapper.realMember(currentType[0], reader.getNodeName());
    if (mapper.shouldSerializeMember(currentType[0], fieldName)) {
      String classAttribute = HierarchicalStreams.readClassAttribute(reader, mapper);
      final Class type;
      if (classAttribute != null) {
        type = mapper.realClass(classAttribute);
      } else {
        type = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, currentType[0]));
      }
      Object value = context.convertAnother(result, type);
      reflectionProvider.writeField(result, fieldName, value, currentType[0]);
    }
    reader.moveUp();
  }
  reader.moveUp();
}

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

@Override
public String realMember(final Class<?> type, final String serialized) {
  return realMemberMapper.realMember(type, serialized);
}

代码示例来源:origin: ovea-deprecated/jetty-session-redis

public String realMember(Class type, String serialized) {
  return wrapped.realMember(type, serialized);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public String realMember(Class type, String serialized) {
  return delegate.realMember(type, serialized);
}

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

public String realMember(Class type, String serialized) {
  return realMemberMapper.realMember(type, serialized);
}

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

public String realMember(Class type, String serialized) {
  return realMemberMapper.realMember(type, serialized);
}

代码示例来源:origin: org.sonatype.nexus.xstream/xstream

public String realMember(Class type, String serialized) {
  return wrapped.realMember(type, serialized);
}

代码示例来源:origin: org.jvnet.hudson/xstream

public String realMember(Class type, String serialized) {
  return wrapped.realMember(type, serialized);
}

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

public String realMember(Class type, String serialized) {
  return realMemberMapper.realMember(type, serialized);
}

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

public String realMember(Class type, String serialized) {
  return wrapped.realMember(type, serialized);
}

相关文章