@Override public PropertyName findRootName(AnnotatedClass ac) { PropertyName name1 = _primary.findRootName(ac); if (name1 == null) { return _secondary.findRootName(ac); } if (name1.hasSimpleName()) { return name1; } // name1 is empty; how about secondary? PropertyName name2 = _secondary.findRootName(ac); return (name2 == null) ? name1 : name2; }
public PropertyName findRootName(Class<?> rootType, MapperConfig<?> config) { ClassKey key = new ClassKey(rootType); PropertyName name = _rootNames.get(key); if (name != null) { return name; } BeanDescription beanDesc = config.introspectClassAnnotations(rootType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); name = intr.findRootName(ac); // No answer so far? Let's just default to using simple class name if (name == null || !name.hasSimpleName()) { // Should we strip out enclosing class tho? For now, nope: name = PropertyName.construct(rootType.getSimpleName()); } _rootNames.put(key, name); return name; }
protected String _findTypeName(JavaType type, BeanDescription beanDesc) { // First, handle container types; they require recursion if (type.isArrayType()) { return "Array"; } if (type.isMapLikeType() && ReflectionUtils.isSystemType(type)) { return "Map"; } if (type.isContainerType() && ReflectionUtils.isSystemType(type)) { if (Set.class.isAssignableFrom(type.getRawClass())) { return "Set"; } return "List"; } if (beanDesc == null) { beanDesc = _mapper.getSerializationConfig().introspectClassAnnotations(type); } PropertyName rootName = _intr.findRootName(beanDesc.getClassInfo()); if (rootName != null && rootName.hasSimpleName()) { return rootName.getSimpleName(); } return _typeNameResolver.nameForType(type); }
@Override public String findRootName(AnnotatedClass ac) { String name1 = _primary.findRootName(ac); if (name1 == null) { return _secondary.findRootName(ac); } else if (name1.length() > 0) { return name1; } // name1 is empty; how about secondary? String name2 = _secondary.findRootName(ac); return (name2 == null) ? name1 : name2; }
@Override public PropertyName findRootName(AnnotatedClass ac) { PropertyName name1 = _primary.findRootName(ac); if (name1 == null) { return _secondary.findRootName(ac); } if (name1.hasSimpleName()) { return name1; } // name1 is empty; how about secondary? PropertyName name2 = _secondary.findRootName(ac); return (name2 == null) ? name1 : name2; }
@Override public PropertyName findRootName(AnnotatedClass ac) { PropertyName name1 = _primary.findRootName(ac); if (name1 == null) { return _secondary.findRootName(ac); } if (name1.hasSimpleName()) { return name1; } // name1 is empty; how about secondary? PropertyName name2 = _secondary.findRootName(ac); return (name2 == null) ? name1 : name2; }
@Override public PropertyName findRootName(AnnotatedClass ac) { PropertyName name1 = _primary.findRootName(ac); if (name1 == null) { return _secondary.findRootName(ac); } if (name1.hasSimpleName()) { return name1; } // name1 is empty; how about secondary? PropertyName name2 = _secondary.findRootName(ac); return (name2 == null) ? name1 : name2; }
@Override public PropertyName findRootName(AnnotatedClass ac) { PropertyName name1 = _primary.findRootName(ac); if (name1 == null) { return _secondary.findRootName(ac); } if (name1.hasSimpleName()) { return name1; } // name1 is empty; how about secondary? PropertyName name2 = _secondary.findRootName(ac); return (name2 == null) ? name1 : name2; }
@Override public PropertyName findRootName(AnnotatedClass ac) { PropertyName name1 = _primary.findRootName(ac); if (name1 == null) { return _secondary.findRootName(ac); } if (name1.hasSimpleName()) { return name1; } // name1 is empty; how about secondary? PropertyName name2 = _secondary.findRootName(ac); return (name2 == null) ? name1 : name2; }
protected QName _findRootName(Class<?> rootType, MapperConfig<?> config) { BeanDescription beanDesc = config.introspectClassAnnotations(rootType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); String localName = null; String ns = null; PropertyName root = intr.findRootName(ac); if (root != null) { localName = root.getSimpleName(); ns = root.getNamespace(); } // No answer so far? Let's just default to using simple class name if (localName == null || localName.length() == 0) { // Should we strip out enclosing class tho? For now, nope: // one caveat: array simple names end with "[]"; also, "$" needs replacing localName = StaxUtil.sanitizeXmlTypeName(rootType.getSimpleName()); return new QName("", localName); } // Otherwise let's see if there's namespace, too (if we are missing it) if (ns == null || ns.length() == 0) { ns = findNamespace(intr, ac); } if (ns == null) { // some QName impls barf on nulls... ns = ""; } return new QName(ns, localName); }
protected QName _findRootName(Class<?> rootType, MapperConfig<?> config) { BeanDescription beanDesc = config.introspectClassAnnotations(rootType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); String localName = null; String ns = null; PropertyName root = intr.findRootName(ac); if (root != null) { localName = root.getSimpleName(); ns = root.getNamespace(); } // No answer so far? Let's just default to using simple class name if (localName == null || localName.length() == 0) { // Should we strip out enclosing class tho? For now, nope: // one caveat: array simple names end with "[]"; also, "$" needs replacing localName = StaxUtil.sanitizeXmlTypeName(rootType.getSimpleName()); return new QName("", localName); } // Otherwise let's see if there's namespace, too (if we are missing it) if (ns == null || ns.length() == 0) { ns = findNamespace(intr, ac); } if (ns == null) { // some QName impls barf on nulls... ns = ""; } return new QName(ns, localName); }
public PropertyName findRootName(Class<?> rootType, MapperConfig<?> config) { ClassKey key = new ClassKey(rootType); PropertyName name = _rootNames.get(key); if (name != null) { return name; } BeanDescription beanDesc = config.introspectClassAnnotations(rootType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); name = intr.findRootName(ac); // No answer so far? Let's just default to using simple class name if (name == null || !name.hasSimpleName()) { // Should we strip out enclosing class tho? For now, nope: name = PropertyName.construct(rootType.getSimpleName()); } _rootNames.put(key, name); return name; }
public PropertyName findRootName(Class<?> rootType, MapperConfig<?> config) { ClassKey key = new ClassKey(rootType); PropertyName name = _rootNames.get(key); if (name != null) { return name; } BeanDescription beanDesc = config.introspectClassAnnotations(rootType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); name = intr.findRootName(ac); // No answer so far? Let's just default to using simple class name if (name == null || !name.hasSimpleName()) { // Should we strip out enclosing class tho? For now, nope: name = PropertyName.construct(rootType.getSimpleName()); } _rootNames.put(key, name); return name; }
public PropertyName findRootName(Class<?> rootType, MapperConfig<?> config) { ClassKey key = new ClassKey(rootType); PropertyName name = _rootNames.get(key); if (name != null) { return name; } BeanDescription beanDesc = config.introspectClassAnnotations(rootType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); name = intr.findRootName(ac); // No answer so far? Let's just default to using simple class name if (name == null || !name.hasSimpleName()) { // Should we strip out enclosing class tho? For now, nope: name = new PropertyName(rootType.getSimpleName()); } _rootNames.put(key, name); return name; }
public PropertyName findRootName(Class<?> rootType, MapperConfig<?> config) { ClassKey key = new ClassKey(rootType); PropertyName name = _rootNames.get(key); if (name != null) { return name; } BeanDescription beanDesc = config.introspectClassAnnotations(rootType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); name = intr.findRootName(ac); // No answer so far? Let's just default to using simple class name if (name == null || !name.hasSimpleName()) { // Should we strip out enclosing class tho? For now, nope: name = new PropertyName(rootType.getSimpleName()); } _rootNames.put(key, name); return name; }
public synchronized SerializedString findRootName(Class<?> rootType, MapperConfig<?> config) { ClassKey key = new ClassKey(rootType); if (_rootNames == null) { _rootNames = new LRUMap<ClassKey,SerializedString>(20, 200); } else { SerializedString name = _rootNames.get(key); if (name != null) { return name; } } BeanDescription beanDesc = config.introspectClassAnnotations(rootType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); String nameStr = intr.findRootName(ac); // No answer so far? Let's just default to using simple class name if (nameStr == null) { // Should we strip out enclosing class tho? For now, nope: nameStr = rootType.getSimpleName(); } SerializedString name = new SerializedString(nameStr); _rootNames.put(key, name); return name; } }
public synchronized SerializedString findRootName(Class<?> rootType, MapperConfig<?> config) { ClassKey key = new ClassKey(rootType); if (_rootNames == null) { _rootNames = new LRUMap<ClassKey,SerializedString>(20, 200); } else { SerializedString name = _rootNames.get(key); if (name != null) { return name; } } BeanDescription beanDesc = config.introspectClassAnnotations(rootType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); PropertyName pname = intr.findRootName(ac); String nameStr; // No answer so far? Let's just default to using simple class name if (pname == null || !pname.hasSimpleName()) { // Should we strip out enclosing class tho? For now, nope: nameStr = rootType.getSimpleName(); } else { nameStr = pname.getSimpleName(); } SerializedString name = new SerializedString(nameStr); _rootNames.put(key, name); return name; } }
protected String _findTypeName(JavaType type, BeanDescription beanDesc) { // First, handle container types; they require recursion if (type.isArrayType()) { return "Array"; } if (type.isMapLikeType() && ReflectionUtils.isSystemType(type)) { return "Map"; } if (type.isContainerType() && ReflectionUtils.isSystemType(type)) { if (Set.class.isAssignableFrom(type.getRawClass())) { return "Set"; } return "List"; } if (beanDesc == null) { beanDesc = _mapper.getSerializationConfig().introspectClassAnnotations(type); } PropertyName rootName = _intr.findRootName(beanDesc.getClassInfo()); if (rootName != null && rootName.hasSimpleName()) { return rootName.getSimpleName(); } return _typeNameResolver.nameForType(type); }