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

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

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

Mapper.getFieldNameForItemTypeAndName介绍

[英]Get the name of the field that acts as the default collection for an object, or return null if there is none.
[中]获取用作对象默认集合的字段的名称,如果没有,则返回null。

代码示例

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

public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
  return delegate.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
  return getFieldNameForItemTypeAndNameMapper.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  if (fieldName != null) {
    if (implicitCollections == null) {
      implicitCollections = new HashMap(); // lazy instantiation
    }
    Collection collection = (Collection) implicitCollections.get(fieldName);
    if (collection == null) {
      Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
      if (!Collection.class.isAssignableFrom(fieldType)) {
        throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
            " is configured for an implicit Collection, but field is of type " + fieldType.getName());
      }
      if (pureJavaReflectionProvider == null) {
        pureJavaReflectionProvider = new PureJavaReflectionProvider();
      }
      collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
      reflectionProvider.writeField(result, fieldName, collection, null);
      implicitCollections.put(fieldName, collection);
    }
    collection.add(value);
  }
  return implicitCollections;
}

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

implicitFieldName = mapper.getFieldNameForItemTypeAndName(
        fieldDeclaringClass, type, originalNodeName);
    } catch (CannotResolveClassException e) {
if (implicitFieldName == null) {
  implicitFieldName = mapper.getFieldNameForItemTypeAndName(
    fieldDeclaringClass, 
    value != null ? value.getClass() : Mapper.Null.class,

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

@Override
public String getFieldNameForItemTypeAndName(final Class<?> definedIn, final Class<?> itemType,
    final String itemFieldName) {
  return getFieldNameForItemTypeAndNameMapper.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
  return wrapped.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
  return delegate.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
  return getFieldNameForItemTypeAndNameMapper.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
  return wrapped.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
  return getFieldNameForItemTypeAndNameMapper.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
  return getFieldNameForItemTypeAndNameMapper.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
  return wrapped.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) {
  return wrapped.getFieldNameForItemTypeAndName(definedIn, itemType, itemFieldName);
}

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

private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  if (fieldName != null) {
    if (implicitCollections == null) {
      implicitCollections = new HashMap(); // lazy instantiation
    }
    Collection collection = (Collection) implicitCollections.get(fieldName);
    if (collection == null) {
      Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
      if (!Collection.class.isAssignableFrom(fieldType)) {
        throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
            " is configured for an implicit Collection, but field is of type " + fieldType.getName());
      }
      if (pureJavaReflectionProvider == null) {
        pureJavaReflectionProvider = new PureJavaReflectionProvider();
      }
      collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
      reflectionProvider.writeField(result, fieldName, collection, null);
      implicitCollections.put(fieldName, collection);
    }
    collection.add(value);
  }
  return implicitCollections;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  if (fieldName != null) {
    if (implicitCollections == null) {
      implicitCollections = new HashMap(); // lazy instantiation
    }
    Collection collection = (Collection) implicitCollections.get(fieldName);
    if (collection == null) {
      Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
      if (!Collection.class.isAssignableFrom(fieldType)) {
        throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
            " is configured for an implicit Collection, but field is of type " + fieldType.getName());
      }
      if (pureJavaReflectionProvider == null) {
        pureJavaReflectionProvider = new PureJavaReflectionProvider();
      }
      collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
      reflectionProvider.writeField(result, fieldName, collection, null);
      implicitCollections.put(fieldName, collection);
    }
    collection.add(value);
  }
  return implicitCollections;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  if (fieldName != null) {
    if (implicitCollections == null) {
      implicitCollections = new HashMap(); // lazy instantiation
    }
    Collection collection = (Collection) implicitCollections.get(fieldName);
    if (collection == null) {
      Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
      if (!Collection.class.isAssignableFrom(fieldType)) {
        throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
            " is configured for an implicit Collection, but field is of type " + fieldType.getName());
      }
      if (pureJavaReflectionProvider == null) {
        pureJavaReflectionProvider = new PureJavaReflectionProvider();
      }
      collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
      reflectionProvider.writeField(result, fieldName, collection, null);
      implicitCollections.put(fieldName, collection);
    }
    collection.add(value);
  }
  return implicitCollections;
}

代码示例来源:origin: hudson/hudson-2.x

private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  if (fieldName != null) {
    if (implicitCollections == null) {
      implicitCollections = new HashMap(); // lazy instantiation
    }
    Collection collection = (Collection) implicitCollections.get(fieldName);
    if (collection == null) {
      Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
      if (!Collection.class.isAssignableFrom(fieldType)) {
        throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
            " is configured for an implicit Collection, but field is of type " + fieldType.getName());
      }
      if (pureJavaReflectionProvider == null) {
        pureJavaReflectionProvider = new PureJavaReflectionProvider();
      }
      collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
      reflectionProvider.writeField(result, fieldName, collection, null);
      implicitCollections.put(fieldName, collection);
    }
    collection.add(value);
  }
  return implicitCollections;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  if (fieldName != null) {
    if (implicitCollections == null) {
      implicitCollections = new HashMap(); // lazy instantiation
    }
    Collection collection = (Collection) implicitCollections.get(fieldName);
    if (collection == null) {
      Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
      if (!Collection.class.isAssignableFrom(fieldType)) {
        throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName()
            + " is configured for an implicit Collection, but field is of type " + fieldType.getName());
      }
      if (pureJavaReflectionProvider == null) {
        pureJavaReflectionProvider = new PureJavaReflectionProvider();
      }
      collection = (Collection) pureJavaReflectionProvider.newInstance(fieldType);
      reflectionProvider.writeField(result, fieldName, collection, null);
      implicitCollections.put(fieldName, collection);
    }
    collection.add(value);
  }
  return implicitCollections;
}

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

private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value,
  Map implicitCollections, Object result, String itemFieldName) {
  String fieldName = mapper.getFieldNameForItemTypeAndName(
    context.getRequiredType(), value != null ? value.getClass() : Mapper.Null.class,
    itemFieldName);

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

private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value,
  Map implicitCollections, Object result, String itemFieldName) {
  String fieldName = mapper.getFieldNameForItemTypeAndName(
    context.getRequiredType(), value != null ? value.getClass() : Mapper.Null.class,
    itemFieldName);

相关文章