public String name() { return core.name(); }
/** * Puts definitions for XML attribute. * * @param attribute XmlAttribute * @param property property instance to be updated */ private static void applyAttribute(XmlAttribute attribute, Schema property) { if (attribute != null) { final XML xml = getXml(property); xml.setAttribute(true); setName(attribute.namespace(), attribute.name(), property); } }
public String name() { return core.name(); }
private QName calcXmlName(XmlAttribute att) { String uri; String local; uri = att.namespace(); local = att.name(); // compute the default if(local.equals("##default")) local = NameConverter.standard.toVariableName(getName()); if(uri.equals("##default")) { XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this ); // JAX-RPC doesn't want the default namespace URI swapping to take effect to // local "unqualified" elements. UGLY. if(xs!=null) { switch(xs.attributeFormDefault()) { case QUALIFIED: uri = parent.getTypeName().getNamespaceURI(); if(uri.length()==0) uri = parent.builder.defaultNsUri; break; case UNQUALIFIED: case UNSET: uri = ""; } } else uri = ""; } return new QName(uri.intern(),local.intern()); }
@Override public Optional<Field> load(@Nonnull final Class cls) throws Exception { for (Field field : declaredFields.getUnchecked(cls)) { if (field.getType().equals(String.class)) { final XmlAttribute annotation = field.getAnnotation(XmlAttribute.class); if (annotation != null && (field.getName().equals("expand") || "expand".equals(annotation.name()))) { return Optional.of(field); } } } return Optional.absent(); } });
private QName calcXmlName(XmlAttribute att) { String uri; String local; uri = att.namespace(); local = att.name(); // compute the default if(local.equals("##default")) local = NameConverter.standard.toVariableName(getName()); if(uri.equals("##default")) { XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this ); // JAX-RPC doesn't want the default namespace URI swapping to take effect to // local "unqualified" elements. UGLY. if(xs!=null) { switch(xs.attributeFormDefault()) { case QUALIFIED: uri = parent.getTypeName().getNamespaceURI(); if(uri.length()==0) uri = parent.builder.defaultNsUri; break; case UNQUALIFIED: case UNSET: uri = ""; } } else uri = ""; } return new QName(uri.intern(),local.intern()); }
public String name() { return core.name(); }
return _combineNames(attribute.name(), attribute.namespace(), defaultName);
public String name() { return core.name(); }
/** * Puts definitions for XML attribute. * * @param attribute XmlAttribute * @param property property instance to be updated */ private static void applyAttribute(XmlAttribute attribute, Schema property) { if (attribute != null) { final XML xml = getXml(property); xml.setAttribute(true); setName(attribute.namespace(), attribute.name(), property); } }
private static CharArray getXmlAttributeName(final Field field){ final XmlAttribute thisAttribute = field.getAnnotation(XmlAttribute.class); return new CharArray(thisAttribute.name()); }
private static String getOverridenNameOrName(Field attributeField) { String attributeName = attributeField.getName(); if (attributeField.isAnnotationPresent(XmlAttribute.class)) { attributeName = attributeField.getAnnotation(XmlAttribute.class) .name(); } if (attributeField.isAnnotationPresent(XmlElement.class)) { attributeName = attributeField.getAnnotation(XmlElement.class) .name(); } if (attributeField.isAnnotationPresent(XmlElementRef.class)) { attributeName = attributeField.getAnnotation(XmlElementRef.class) .name(); } if (JAXB_ATTRIBUTE_NAME_DEFAULT.equals(attributeName)) { attributeName = attributeField.getName(); } return attributeName; }
static public String formatElementOrAttribute(Class<? extends PMMLObject> elementClazz, Field field){ XmlElement element = field.getAnnotation(XmlElement.class); XmlAttribute attribute = field.getAnnotation(XmlAttribute.class); if(element != null){ Class<?> childElementClazz = field.getType(); if(List.class.isAssignableFrom(childElementClazz)){ ParameterizedType listType = (ParameterizedType)field.getGenericType(); Type[] typeArguments = listType.getActualTypeArguments(); if(typeArguments.length != 1){ throw new IllegalArgumentException(); } childElementClazz = (Class<?>)typeArguments[0]; } return getElementName(elementClazz) + "/" + getElementName(childElementClazz); } else if(attribute != null){ return getElementName(elementClazz) + "@" + attribute.name(); } throw new IllegalArgumentException(); }
private String extractName(AccessibleObject object) { String name = null; XmlAttribute attr = object.getAnnotation(XmlAttribute.class); if (attr != null) name = attr.name(); else { XmlElement el = object.getAnnotation(XmlElement.class); if (el != null) name = el.name(); } return DEFAULT_NAME.equals(name) ? null : name; } }
private String extractName(AccessibleObject object) { String name = null; XmlAttribute attr = object.getAnnotation(XmlAttribute.class); if (attr != null) name = attr.name(); else { XmlElement el = object.getAnnotation(XmlElement.class); if (el != null) name = el.name(); } return DEFAULT_NAME.equals(name) ? null : name; } }
protected static String getTypeName(Annotation[] annotations, String dflt) { String name = null; for (Annotation a : annotations) { if (a.annotationType() == XmlAttribute.class) { name = ((XmlAttribute)a).name(); } else if (a.annotationType() == XmlElement.class) { name = ((XmlElement)a).name(); } else if (a.annotationType() == XmlElementRef.class) { name = ((XmlElementRef)a).name(); } else if (a.annotationType() == XmlElementWrapper.class) { name = ((XmlElementWrapper)a).name(); // break the loop as we don't want name to be overwritten by XmlElement break; } else if (a.annotationType() == XmlType.class) { name = ((XmlType)a).name(); } else if (a.annotationType() == XmlTransient.class) { // transient type return null; } } if (DEFAULT_NAME.equals(name)) { return dflt; } return name; }