private <T> boolean _anyExplicits(Linked<T> n) { for (; n != null; n = n.next) { if (n.name != null && n.name.hasSimpleName()) { return true; } } return false; }
public boolean hasFullName() { if (propDef == null) { return false; } PropertyName n = propDef.getFullName(); return n.hasSimpleName(); } }
public Linked(T v, Linked<T> n, PropertyName name, boolean explName, boolean visible, boolean ignored) { value = v; next = n; // ensure that we'll never have missing names this.name = (name == null || name.isEmpty()) ? null : name; if (explName) { if (this.name == null) { // sanity check to catch internal problems throw new IllegalArgumentException("Cannot pass true for 'explName' if name is null/empty"); } // 03-Apr-2014, tatu: But how about name-space only override? // Probably should not be explicit? Or, need to merge somehow? if (!name.hasSimpleName()) { explName = false; } } isNameExplicit = explName; isVisible = visible; isMarkedIgnored = ignored; }
/** * Method called to check to see if this property has a name that would * conflict with a given name. * * @since 2.6 */ public boolean wouldConflictWithName(PropertyName name) { if (_wrapperName != null) { return _wrapperName.equals(name); } // Bit convoluted since our support for namespaces is spotty but: return name.hasSimpleName(_name.getValue()) && !name.hasNamespace(); }
@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; }
if (wrapperName == null || !wrapperName.hasSimpleName()) { continue;
@Override public BeanPropertyDefinition withSimpleName(String newName) { if (_fullName.hasSimpleName(newName) && !_fullName.hasNamespace()) { return this; } return new SimpleBeanPropertyDefinition(_annotationIntrospector, _member, new PropertyName(newName), _metadata, _inclusion); }
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); }
if ((rename != null) && !fullName.hasSimpleName(rename)) { prop = prop.withSimpleName(rename); simpleName = rename;
protected BeanPropertyWriter _constructVirtualProperty(JsonAppend.Attr attr, MapperConfig<?> config, AnnotatedClass ac, JavaType type) { PropertyMetadata metadata = attr.required() ? PropertyMetadata.STD_REQUIRED : PropertyMetadata.STD_OPTIONAL; // could add Index, Description in future, if those matter String attrName = attr.value(); // allow explicit renaming; if none, default to attribute name PropertyName propName = _propertyName(attr.propName(), attr.propNamespace()); if (!propName.hasSimpleName()) { propName = PropertyName.construct(attrName); } // now, then, we need a placeholder for member (no real Field/Method): AnnotatedMember member = new VirtualAnnotatedMember(ac, ac.getRawType(), attrName, type); // and with that and property definition SimpleBeanPropertyDefinition propDef = SimpleBeanPropertyDefinition.construct(config, member, propName, metadata, attr.include()); // can construct the property writer return AttributePropertyWriter.construct(attrName, propDef, ac.getAnnotations(), type); }
private <T> boolean _anyExplicits(Linked<T> n) { for (; n != null; n = n.next) { if (n.name != null && n.name.hasSimpleName()) { return true; } } return false; }
@Override public PropertyName findWrapperName(Annotated ann) { XmlElementWrapper w = findAnnotation(XmlElementWrapper.class, ann, false, false, false); if (w != null) { /* 18-Sep-2013, tatu: As per [jaxb-annotations#24], need to take special care with empty * String, as that should indicate here "use underlying unmodified * property name" (that is, one NOT overridden by @JsonProperty) */ PropertyName name = _combineNames(w.name(), w.namespace(), ""); // clumsy, yes, but has to do: if (!name.hasSimpleName()) { if (ann instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) ann; String str; if (am.getParameterCount() == 0) { str = BeanUtil.okNameForGetter(am, true); } else { str = BeanUtil.okNameForMutator(am, "set", true); } if (str != null) { return name.withSimpleName(str); } } return name.withSimpleName(ann.getName()); } return name; } return null; }
public boolean hasFullName() { if (propDef == null) { return false; } PropertyName n = propDef.getFullName(); return n.hasSimpleName(); } }
@Deprecated // in 2.6, remove from 2.7 protected boolean _hasExplicitParamName(AnnotatedParameter param, AnnotationIntrospector intr) { if (param != null && intr != null) { PropertyName n = intr.findNameForDeserialization(param); return (n != null) && n.hasSimpleName(); } return false; }
protected boolean _hasExplicitParamName(AnnotatedParameter param, AnnotationIntrospector intr) { if (param != null && intr != null) { PropertyName n = intr.findNameForDeserialization(param); return (n != null) && n.hasSimpleName(); } return false; }
protected boolean _hasExplicitParamName(AnnotatedParameter param, AnnotationIntrospector intr) { if (param != null && intr != null) { PropertyName n = intr.findNameForDeserialization(param); return (n != null) && n.hasSimpleName(); } return false; }
@Override public BeanPropertyDefinition withSimpleName(String newName) { if (_fullName.hasSimpleName(newName) && !_fullName.hasNamespace()) { return this; } return new SimpleBeanPropertyDefinition(_annotationIntrospector, _member, new PropertyName(newName), _metadata, _inclusion); }
@Override public BeanPropertyDefinition withSimpleName(String newName) { if (_fullName.hasSimpleName(newName) && !_fullName.hasNamespace()) { return this; } return new SimpleBeanPropertyDefinition(_member, new PropertyName(newName), _introspector, _metadata, _inclusion); }
@Override public BeanPropertyDefinition withSimpleName(String newName) { if (_fullName.hasSimpleName(newName) && !_fullName.hasNamespace()) { return this; } return new SimpleBeanPropertyDefinition(_member, new PropertyName(newName), _introspector, _metadata, _inclusion); }