Package org.codehaus.enunciate.qname

Examples of org.codehaus.enunciate.qname.XmlQNameEnum


  private final XmlQNameEnum.BaseType baseType;

  public QNameEnumTypeDefinition(EnumDeclaration delegate) {
    super(delegate);

    XmlQNameEnum xmlQNameEnum = getAnnotation(XmlQNameEnum.class);
    if (xmlQNameEnum == null) {
      throw new IllegalArgumentException(delegate.getQualifiedName() + " is not a qname enum (not annotated with @org.codehaus.enunciate.qname.XmlQNameEnum)");
    }

    String namespace = getPackage().getNamespace();
    if (!"##default".equals(xmlQNameEnum.namespace())) {
      namespace = xmlQNameEnum.namespace();
    }
    this.namespace = namespace;

    this.baseType = xmlQNameEnum.base();
  }
View Full Code Here


  }

  @Override
  protected Map<String, Object> loadEnumValues() {
    String namespace = getPackage().getNamespace();
    XmlQNameEnum xmlQNameEnum = getAnnotation(XmlQNameEnum.class);
    if (xmlQNameEnum != null && !"##default".equals(xmlQNameEnum.namespace())) {
      namespace = xmlQNameEnum.namespace();
    }
    if (namespace == null) {
      namespace = "";
    }
View Full Code Here

  public static <Q extends Enum<Q>> Q fromQName(final QName qname, Class<Q> clazz) {
    if (qname == null) {
      return null;
    }

    XmlQNameEnum enumInfo = clazz.getAnnotation(XmlQNameEnum.class);
    if (enumInfo == null) {
      throw new IllegalArgumentException(String.format("Class %s isn't a QName enum.", clazz.getName()));
    }
    else if (enumInfo.base() != XmlQNameEnum.BaseType.QNAME) {
      throw new IllegalArgumentException("Class " + clazz.getName() + " is supposed to be converted from a URI (not QName).");
    }

    String namespace = enumInfo.namespace();
    if ("##default".equals(namespace)) {
      Package pkg = clazz.getPackage();
      if (pkg != null) {
        XmlSchema schemaInfo = pkg.getAnnotation(XmlSchema.class);
        namespace = schemaInfo.namespace();
View Full Code Here

    if (e == null) {
      return null;
    }

    Class<?> clazz = e.getDeclaringClass();
    XmlQNameEnum enumInfo = clazz.getAnnotation(XmlQNameEnum.class);
    if (enumInfo == null) {
      throw new IllegalArgumentException("Class " + clazz.getName() + " isn't a QName enum.");
    }
    else if (enumInfo.base() != XmlQNameEnum.BaseType.QNAME) {
      throw new IllegalArgumentException("Class " + clazz.getName() + " is supposed to be converted to a URI (not QName).");
    }

    String namespace = enumInfo.namespace();
    if ("##default".equals(namespace)) {
      Package pkg = clazz.getPackage();
      if (pkg != null) {
        XmlSchema schemaInfo = pkg.getAnnotation(XmlSchema.class);
        namespace = schemaInfo.namespace();
View Full Code Here

    if (defaultBaseUri != null) {
      uriValue = URI.create(defaultBaseUri).resolve(uriValue).toString();
    }

    XmlQNameEnum enumInfo = clazz.getAnnotation(XmlQNameEnum.class);
    if (enumInfo == null) {
      throw new IllegalArgumentException(String.format("Class %s isn't a QName enum.", clazz.getName()));
    }
    else if (enumInfo.base() != XmlQNameEnum.BaseType.URI) {
      throw new IllegalArgumentException("Class " + clazz.getName() + " is supposed to be converted to a QName (not URI).");
    }

    String namespace = enumInfo.namespace();
    if ("##default".equals(namespace)) {
      Package pkg = clazz.getPackage();
      if (pkg != null) {
        XmlSchema schemaInfo = pkg.getAnnotation(XmlSchema.class);
        namespace = schemaInfo.namespace();
View Full Code Here

    }

    String uriValue = null;

    Class<?> clazz = e.getDeclaringClass();
    XmlQNameEnum enumInfo = clazz.getAnnotation(XmlQNameEnum.class);
    if (enumInfo == null) {
      throw new IllegalArgumentException("Class " + clazz.getName() + " isn't a QName enum.");
    }
    else if (enumInfo.base() != XmlQNameEnum.BaseType.URI) {
      throw new IllegalArgumentException("Class " + clazz.getName() + " is supposed to be converted from a QName (not URI).");
    }

    String namespace = enumInfo.namespace();
    if ("##default".equals(namespace)) {
      Package pkg = clazz.getPackage();
      if (pkg != null) {
        XmlSchema schemaInfo = pkg.getAnnotation(XmlSchema.class);
        namespace = schemaInfo.namespace();
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.qname.XmlQNameEnum

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.