Package com.sun.mirror.declaration

Examples of com.sun.mirror.declaration.ClassDeclaration


  private final TypeMirror adaptingType;

  public AdapterType(ClassType adapterType) {
    super(adapterType);

    ClassDeclaration adapterDeclaration = adapterType.getDeclaration();

    ClassType adaptorInterfaceType = findXmlAdapterType(adapterDeclaration);
    if (adaptorInterfaceType == null) {
      throw new ValidationException(adapterDeclaration.getPosition(), adapterDeclaration.getQualifiedName() + " is not an instance of javax.xml.bind.annotation.adapters.XmlAdapter.");
    }

    Collection<TypeMirror> adaptorTypeArgs = adaptorInterfaceType.getActualTypeArguments();
    if ((adaptorTypeArgs == null) || (adaptorTypeArgs.size() != 2)) {
      throw new ValidationException(adapterDeclaration.getPosition(), adapterDeclaration.getQualifiedName() +
        " must specify both a value type and a bound type.");
    }

    Iterator<TypeMirror> formalTypeIt = adaptorTypeArgs.iterator();
    this.adaptingType = TypeMirrorDecorator.decorate(formalTypeIt.next());
    TypeMirror boundTypeMirror = formalTypeIt.next();
    if (!(boundTypeMirror instanceof ReferenceType)) {
      throw new ValidationException(adapterDeclaration.getPosition(), adapterDeclaration.getQualifiedName() + ": illegal XML adapter: not adapting a reference type (" + boundTypeMirror + ").");
    }
    else while (boundTypeMirror instanceof TypeVariable) {
      //unwrap the type variable to find the bounds.
      TypeParameterDeclaration declaration = ((TypeVariable) boundTypeMirror).getDeclaration();
      if (declaration == null) {
        throw new IllegalStateException(adapterDeclaration.getQualifiedName() + ": unable to find type parameter declaration for type variable " + boundTypeMirror + ".");
      }
      else if (declaration.getBounds() != null && !declaration.getBounds().isEmpty()) {
        boundTypeMirror = declaration.getBounds().iterator().next();
      }
      else {
View Full Code Here


      setMapXmlType(mapType);
    }
    else {
      XmlType xmlType = null;
      EnunciateFreemarkerModel model = (EnunciateFreemarkerModel) FreemarkerModel.get();
      ClassDeclaration declaration = classType.getDeclaration();
      if (declaration != null) {
        XmlType knownType = model.getKnownType(declaration);
        if (knownType != null) {
          xmlType = knownType;
        }
View Full Code Here

  /**
   * tests a basic type definition.
   */
  public void testBasicTypeDefinition() throws Exception {
    ClassDeclaration elementBeanOneDecl = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne");
    ComplexTypeDefinition elementBeanOneType = new ComplexTypeDefinition(elementBeanOneDecl);
    RootElementDeclaration elementBeanOne = new RootElementDeclaration(elementBeanOneDecl, elementBeanOneType);

    EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
    FreemarkerModel.set(model);
View Full Code Here

  /**
   * tests a extended type definition.
   */
  public void testExtendedTypeDefinition() throws Exception {
    ClassDeclaration elementBeanOneDecl = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne");
    ComplexTypeDefinition elementBeanOneType = new ComplexTypeDefinition(elementBeanOneDecl);
    RootElementDeclaration elementBeanOne = new RootElementDeclaration(elementBeanOneDecl, elementBeanOneType);

    EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
    FreemarkerModel.set(model);
View Full Code Here

  public void testValidateEndpointImplementation() throws Exception {
    DefaultValidator validator = new DefaultValidator();

    EndpointInterface ei = new EndpointInterface(getDeclaration("org.codehaus.enunciate.samples.services.NoNamespaceWebService"));

    ClassDeclaration declaration = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.services.NotAWebService");
    EndpointImplementation impl = new EndpointImplementation(declaration, ei);
    assertTrue("A class not annotated with @WebService shouldn't be seen as an endpoint implementation.", validator.validateEndpointImplementation(impl).hasErrors());

    declaration = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.services.InvalidEIReference");
    impl = new EndpointImplementation(declaration, ei);
View Full Code Here

  /**
   * test validating a type definition
   */
  public void testValidateTypeDefinition() throws Exception {
    ClassDeclaration elementBeanOneDecl = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne");
    ComplexTypeDefinition elementBeanOneType = new ComplexTypeDefinition(elementBeanOneDecl);
    RootElementDeclaration elementBeanOne = new RootElementDeclaration(elementBeanOneDecl, elementBeanOneType);

    EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
    model.add(elementBeanOneType);
View Full Code Here

          }
          File sourceFile = position.file();
          getEnunciate().copyFile(sourceFile, getServerSideDestFile(sourceFile, webFault));
        }
        else {
          ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
          if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
            model.put("superFault", allFaults.get(superFault.getQualifiedName()));
          }
          else {
            model.remove("superFault");
          }
View Full Code Here

  /**
   * tests a basic element ref.
   */
  public void testBasicElementRef() throws Exception {
    ClassDeclaration elementBeanOneDecl = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne");
    ComplexTypeDefinition elementBeanOneType = new ComplexTypeDefinition(elementBeanOneDecl);
    RootElementDeclaration elementBeanOne = new RootElementDeclaration(elementBeanOneDecl, elementBeanOneType);

    EnunciateFreemarkerModel model = ((EnunciateFreemarkerModel) FreemarkerModel.get());
    model.add(elementBeanOneType);
View Full Code Here

  /**
   * tests an element ref with an explicit type.
   */
  public void testExplicitTypeElementRef() throws Exception {
    ClassDeclaration elementBeanOneDecl = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne");
    ComplexTypeDefinition elementBeanOneType = new ComplexTypeDefinition(elementBeanOneDecl);
    RootElementDeclaration elementBeanOne = new RootElementDeclaration(elementBeanOneDecl, elementBeanOneType);

    EnunciateFreemarkerModel model = ((EnunciateFreemarkerModel) FreemarkerModel.get());
    model.add(elementBeanOneType);
View Full Code Here

  /**
   * tests a JAXBElement ref
   */
  public void testJAXBElementRef() throws Exception {
    ClassDeclaration elementBeanOneDecl = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne");
    ComplexTypeDefinition elementBeanOneType = new ComplexTypeDefinition(elementBeanOneDecl);
    RootElementDeclaration elementBeanOne = new RootElementDeclaration(elementBeanOneDecl, elementBeanOneType);

    EnunciateFreemarkerModel model = ((EnunciateFreemarkerModel) FreemarkerModel.get());
    model.add(elementBeanOneType);
View Full Code Here

TOP

Related Classes of com.sun.mirror.declaration.ClassDeclaration

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.