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

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

本文整理了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

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

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

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

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

  1. private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  2. String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  3. if (fieldName != null) {
  4. if (implicitCollections == null) {
  5. implicitCollections = new HashMap(); // lazy instantiation
  6. }
  7. Collection collection = (Collection) implicitCollections.get(fieldName);
  8. if (collection == null) {
  9. Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
  10. if (!Collection.class.isAssignableFrom(fieldType)) {
  11. throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
  12. " is configured for an implicit Collection, but field is of type " + fieldType.getName());
  13. }
  14. if (pureJavaReflectionProvider == null) {
  15. pureJavaReflectionProvider = new PureJavaReflectionProvider();
  16. }
  17. collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
  18. reflectionProvider.writeField(result, fieldName, collection, null);
  19. implicitCollections.put(fieldName, collection);
  20. }
  21. collection.add(value);
  22. }
  23. return implicitCollections;
  24. }

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

  1. implicitFieldName = mapper.getFieldNameForItemTypeAndName(
  2. fieldDeclaringClass, type, originalNodeName);
  3. } catch (CannotResolveClassException e) {
  4. if (implicitFieldName == null) {
  5. implicitFieldName = mapper.getFieldNameForItemTypeAndName(
  6. fieldDeclaringClass,
  7. value != null ? value.getClass() : Mapper.Null.class,

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  2. String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  3. if (fieldName != null) {
  4. if (implicitCollections == null) {
  5. implicitCollections = new HashMap(); // lazy instantiation
  6. }
  7. Collection collection = (Collection) implicitCollections.get(fieldName);
  8. if (collection == null) {
  9. Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
  10. if (!Collection.class.isAssignableFrom(fieldType)) {
  11. throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
  12. " is configured for an implicit Collection, but field is of type " + fieldType.getName());
  13. }
  14. if (pureJavaReflectionProvider == null) {
  15. pureJavaReflectionProvider = new PureJavaReflectionProvider();
  16. }
  17. collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
  18. reflectionProvider.writeField(result, fieldName, collection, null);
  19. implicitCollections.put(fieldName, collection);
  20. }
  21. collection.add(value);
  22. }
  23. return implicitCollections;
  24. }

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

  1. private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  2. String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  3. if (fieldName != null) {
  4. if (implicitCollections == null) {
  5. implicitCollections = new HashMap(); // lazy instantiation
  6. }
  7. Collection collection = (Collection) implicitCollections.get(fieldName);
  8. if (collection == null) {
  9. Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
  10. if (!Collection.class.isAssignableFrom(fieldType)) {
  11. throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
  12. " is configured for an implicit Collection, but field is of type " + fieldType.getName());
  13. }
  14. if (pureJavaReflectionProvider == null) {
  15. pureJavaReflectionProvider = new PureJavaReflectionProvider();
  16. }
  17. collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
  18. reflectionProvider.writeField(result, fieldName, collection, null);
  19. implicitCollections.put(fieldName, collection);
  20. }
  21. collection.add(value);
  22. }
  23. return implicitCollections;
  24. }

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

  1. private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  2. String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  3. if (fieldName != null) {
  4. if (implicitCollections == null) {
  5. implicitCollections = new HashMap(); // lazy instantiation
  6. }
  7. Collection collection = (Collection) implicitCollections.get(fieldName);
  8. if (collection == null) {
  9. Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
  10. if (!Collection.class.isAssignableFrom(fieldType)) {
  11. throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
  12. " is configured for an implicit Collection, but field is of type " + fieldType.getName());
  13. }
  14. if (pureJavaReflectionProvider == null) {
  15. pureJavaReflectionProvider = new PureJavaReflectionProvider();
  16. }
  17. collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
  18. reflectionProvider.writeField(result, fieldName, collection, null);
  19. implicitCollections.put(fieldName, collection);
  20. }
  21. collection.add(value);
  22. }
  23. return implicitCollections;
  24. }

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

  1. private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  2. String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  3. if (fieldName != null) {
  4. if (implicitCollections == null) {
  5. implicitCollections = new HashMap(); // lazy instantiation
  6. }
  7. Collection collection = (Collection) implicitCollections.get(fieldName);
  8. if (collection == null) {
  9. Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
  10. if (!Collection.class.isAssignableFrom(fieldType)) {
  11. throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
  12. " is configured for an implicit Collection, but field is of type " + fieldType.getName());
  13. }
  14. if (pureJavaReflectionProvider == null) {
  15. pureJavaReflectionProvider = new PureJavaReflectionProvider();
  16. }
  17. collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
  18. reflectionProvider.writeField(result, fieldName, collection, null);
  19. implicitCollections.put(fieldName, collection);
  20. }
  21. collection.add(value);
  22. }
  23. return implicitCollections;
  24. }

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

  1. private Map writeValueToImplicitCollection(UnmarshallingContext context, Object value, Map implicitCollections, Object result, String itemFieldName) {
  2. String fieldName = mapper.getFieldNameForItemTypeAndName(context.getRequiredType(), value.getClass(), itemFieldName);
  3. if (fieldName != null) {
  4. if (implicitCollections == null) {
  5. implicitCollections = new HashMap(); // lazy instantiation
  6. }
  7. Collection collection = (Collection) implicitCollections.get(fieldName);
  8. if (collection == null) {
  9. Class fieldType = mapper.defaultImplementationOf(reflectionProvider.getFieldType(result, fieldName, null));
  10. if (!Collection.class.isAssignableFrom(fieldType)) {
  11. throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName()
  12. + " is configured for an implicit Collection, but field is of type " + fieldType.getName());
  13. }
  14. if (pureJavaReflectionProvider == null) {
  15. pureJavaReflectionProvider = new PureJavaReflectionProvider();
  16. }
  17. collection = (Collection) pureJavaReflectionProvider.newInstance(fieldType);
  18. reflectionProvider.writeField(result, fieldName, collection, null);
  19. implicitCollections.put(fieldName, collection);
  20. }
  21. collection.add(value);
  22. }
  23. return implicitCollections;
  24. }

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

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

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

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

相关文章