Package org.codehaus.enunciate.contract.jaxb.types

Examples of org.codehaus.enunciate.contract.jaxb.types.XmlType


    }
  }

  private void aggregateElements(List<Accessor> accessors, TypeDefinition typeDef) {
    if (!typeDef.isBaseObject()) {
      XmlType baseType = typeDef.getBaseType();
      if (baseType instanceof XmlClassType) {
        aggregateElements(accessors, ((XmlClassType)baseType).getTypeDefinition());
      }
    }
View Full Code Here


   *
   * @param declaredType The declared type.
   * @return The known type for the given declared type, or null if the declared type is not known.
   */
  public XmlType getKnownType(DeclaredType declaredType) {
    XmlType knownType = null;
    TypeDeclaration declaration = declaredType.getDeclaration();
    if (declaration != null) {
      if (knownTypes.containsKey(declaration.getQualifiedName())) {
        //first check the known types.
        knownType = getKnownType(declaration);
View Full Code Here

  }

  // Inherited.
  @Override
  public XmlType getBaseType() {
    XmlType xmlType = KnownXmlType.STRING;

    if (xmlEnum != null) {
      try {
        try {
          Class enumClass = xmlEnum.value();
View Full Code Here

   *
   * @return The xml type of this result.
   */
  public XmlType getXmlType() {
    try {
      XmlType xmlType = XmlTypeFactory.findSpecifiedType(this);
      if (xmlType == null) {
        xmlType = XmlTypeFactory.getXmlType(getType());
      }
      return xmlType;
    }
View Full Code Here

   *
   * @return The xml type.
   */
  public XmlType getXmlType() {
    try {
      XmlType xmlType = XmlTypeFactory.findSpecifiedType(this);

      if (xmlType == null) {
        TypeMirror type = getType();
        if (isHolder()) {
          Collection<TypeMirror> typeArgs = ((DeclaredType) type).getActualTypeArguments();
View Full Code Here

  // Inherited.
  public ValidationResult validateSimpleType(SimpleTypeDefinition simpleType) {
    ValidationResult result = validateTypeDefinition(simpleType);

    try {
      XmlType baseType = simpleType.getBaseType();
      if (baseType == null) {
        result.addError(simpleType, "No base type specified.");
      }
      else if ((baseType instanceof XmlClassType) && (((XmlClassType) baseType).getTypeDefinition() instanceof ComplexTypeDefinition)) {
        result.addError(simpleType, "A simple type must have a simple base type. " + new QName(baseType.getNamespace(), baseType.getName())
          + " is a complex type.");
      }
    }
    catch (ValidationException e) {
      result.addError(simpleType, e.getMessage());
View Full Code Here

  }

  public ValidationResult validateAttribute(Attribute attribute) {
    ValidationResult result = validateAccessor(attribute);

    XmlType baseType = attribute.getBaseType();
    if (baseType == null) {
      result.addError(attribute, "No base type specified.");
    }
    else if ((baseType instanceof XmlClassType) && (((XmlClassType) baseType).getTypeDefinition() instanceof ComplexTypeDefinition)) {
      result.addError(attribute, "An attribute must have a simple base type. " + new QName(baseType.getNamespace(), baseType.getName())
        + " is a complex type.");
    }

    return result;
  }
View Full Code Here

  }

  public ValidationResult validateValue(Value value) {
    ValidationResult result = validateAccessor(value);

    XmlType baseType = value.getBaseType();
    if (baseType == null) {
      result.addError(value, "No base type specified.");
    }
    else if ((baseType instanceof XmlClassType) && (((XmlClassType) baseType).getTypeDefinition() instanceof ComplexTypeDefinition)) {
      result.addError(value, "An xml value must have a simple base type. " + new QName(baseType.getNamespace(), baseType.getName())
        + " is a complex type.");
    }

    return result;
  }
View Full Code Here

        result.addWarning(accessor, "An XML IDREF must have a base type that references another type that has an XML ID.");
      }
    }

    if (accessor.isReferencesQNameEnum()) {
      XmlType baseType = accessor.getBaseType();
      if (baseType == null || (!KnownXmlType.QNAME.getQname().equals(baseType.getQname()) && !KnownXmlType.ANY_URI.getQname().equals(baseType.getQname()) && !KnownXmlType.STRING.getQname().equals(baseType.getQname()))) {
        result.addError(accessor, "An accessor that references a QName enumeration must return QName or URI.");
      }

      TypeMirror enumRef = accessor.getQNameEnumRef();
      if (!(enumRef instanceof EnumType) || ((EnumType) enumRef).getDeclaration() == null || ((DeclaredType) enumRef).getDeclaration().getAnnotation(XmlQNameEnum.class) == null) {
View Full Code Here

    if (isSwaRef()) {
      return KnownXmlType.SWAREF;
    }

    try {
      XmlType xmlType = XmlTypeFactory.findSpecifiedType(this);
      return (xmlType != null) ? xmlType : XmlTypeFactory.getXmlType(getAccessorType());
    }
    catch (XmlTypeException e) {
      throw new ValidationException(getPosition(), "Accessor " + getName() + " of " + getTypeDefinition().getQualifiedName() + ": " + e.getMessage());
    }
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.contract.jaxb.types.XmlType

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.