use of com.zimbra.soap.json.jackson.annotate.ZimbraJsonAttribute in project zm-mailbox by Zimbra.
the class NameInfo method setWrappedInfo.
private void setWrappedInfo(AnnotationIntrospector ai, AnnotatedMember prop, String defaultWrappedName) {
ZimbraUniqueElement uniqueElemAnnot = prop.getAnnotation(ZimbraUniqueElement.class);
if (uniqueElemAnnot != null) {
treatAsUniqueElement = uniqueElemAnnot.value();
}
ZimbraJsonArrayForWrapper arrayForWrapperAnnot = prop.getAnnotation(ZimbraJsonArrayForWrapper.class);
if (arrayForWrapperAnnot != null) {
wrapperIsArray = arrayForWrapperAnnot.value();
}
ZimbraKeyValuePairs kvpAnnot = prop.getAnnotation(ZimbraKeyValuePairs.class);
if (kvpAnnot != null) {
keyValuePairs = kvpAnnot.value();
return;
}
ZimbraJsonAttribute jsonAttributeAnnot = prop.getAnnotation(ZimbraJsonAttribute.class);
if (jsonAttributeAnnot != null) {
treatAsAttribute = jsonAttributeAnnot.value();
}
mixedAllowed = (prop.getAnnotation(XmlMixed.class) != null);
anyElementAllowed = (prop.getAnnotation(XmlAnyElement.class) != null);
anyAttributeAllowed = (prop.getAnnotation(XmlAnyAttribute.class) != null);
XmlElement elemAnnot = prop.getAnnotation(XmlElement.class);
if (elemAnnot != null) {
wrappedName = getQName(prop.getName(), elemAnnot.namespace(), elemAnnot.name());
return;
}
XmlElementRef elemRefAnnot = prop.getAnnotation(XmlElementRef.class);
wrappedName = getElementRefName(elemRefAnnot);
if (wrappedName != null) {
return;
}
XmlElements elemsAnnot = prop.getAnnotation(XmlElements.class);
if (elemsAnnot != null) {
XmlElement[] elems = elemsAnnot.value();
wrappedNameMap = Maps.newHashMapWithExpectedSize(elems.length);
for (XmlElement elem : elems) {
QName qn = getQName(prop.getName(), elem.namespace(), elem.name());
Class<?> kls = elem.type();
getWrappedNameMap().put(kls, qn);
}
return;
}
XmlElementRefs elemRefsAnnot = prop.getAnnotation(XmlElementRefs.class);
if (elemRefsAnnot != null) {
XmlElementRef[] elems = elemRefsAnnot.value();
wrappedNameMap = Maps.newHashMapWithExpectedSize(elems.length);
for (XmlElementRef elem : elems) {
QName qn = getElementRefName(elem);
Class<?> kls = elem.type();
getWrappedNameMap().put(kls, qn);
}
return;
}
if (wrapperName != null) {
// We have a wrapper but nothing to tell us what the wrapped name should be, so use default
wrappedName = new QName("", defaultWrappedName);
}
}
Aggregations