Examples of AnnotationDescriptor


Examples of com.codingcrayons.aspectfaces.annotation.registration.AnnotationDescriptor

        Class<AnnotationDescriptor> fieldDescriptorClass = (Class<AnnotationDescriptor>) clazz;

        try {
          StringBuilder builder = new StringBuilder();

          AnnotationDescriptor descriptor = fieldDescriptorClass.newInstance();
          AnnotationProvider provider = new AnnotationProvider("Dummy");

          String currentPackageName = descriptor.getAnnotationName().substring(0,
            descriptor.getAnnotationName().lastIndexOf("."));
          if (!packageName.equals(currentPackageName)) {
            packageName = currentPackageName;
            builder.append('\n');
            builder.append(currentPackageName).append('\n');
            builder.append('\n');
          }

          List<Variable> vars = new ArrayList<Variable>();
          if (descriptor instanceof VariableJoinPoint) {
            vars = ((VariableJoinPoint) descriptor).getVariables(provider);
          }
          String evalValue = "";
          if (descriptor instanceof EvaluableJoinPoint) {
            evalValue = ((EvaluableJoinPoint) descriptor).getEvaluableValue(provider);
          }
          String order = "";
          if (descriptor instanceof OrderJoinPoint) {
            order = "order";
          }
          String role = "";
          if (descriptor instanceof SecurityJoinPoint) {
            role = "roles";
          }
          builder.append("@").append(descriptor.getAnnotationName().substring(descriptor.getAnnotationName().lastIndexOf(".") + 1)).append(':');
          builder.append(fieldDescriptorClass.getSimpleName()).append(':');
          if (!vars.isEmpty()) {
            builder.append("variables=");
            for (int i = 0; i < vars.size(); ++i) {
              builder.append("").append(vars.get(i).getName());
              if (i < vars.size() - 1) {
                builder.append(",");
              }
            }
            builder.append(':');
          } else {
            builder.append(':');
          }
          if (evalValue != null && !evalValue.isEmpty()) {
            builder.append("evaluable variables=").append(evalValue).append(':');
          } else {
            builder.append(':');
          }
          if (order != null && !order.isEmpty()) {
            builder.append("order=").append(order).append(':');
          } else {
            builder.append(':');
          }
          if (role != null && !role.isEmpty()) {
            builder.append("roles=").append(role).append(':');
          } else {
            builder.append(':');
          }
          if (FULL) {
            builder.append(descriptor.getAnnotationName()).append(':');
            builder.append(fieldDescriptorClass.getName()).append(':');
          }
          builder.append('\n');
          LOGGER.trace(builder.toString());
        } catch (InstantiationException e) {
View Full Code Here

Examples of org.apache.felix.ipojo.manipulation.ClassChecker.AnnotationDescriptor

         mv.visitInsn(RETURN);

         // Move annotations
         if (annotations != null) {
             for (int i = 0; i < annotations.size(); i++) {
                 AnnotationDescriptor ad = (AnnotationDescriptor) annotations.get(i);
                 ad.visitAnnotation(mv);
             }
         }

         // Move parameter annotations if any
         if (paramAnnotations != null  && ! paramAnnotations.isEmpty()) {
             Iterator ids = paramAnnotations.keySet().iterator();
             while(ids.hasNext()) {
                 Integer id = (Integer) ids.next();
                 List ads = (List) paramAnnotations.get(id);
                 for (int i = 0; i < ads.size(); i++) {
                     AnnotationDescriptor ad = (AnnotationDescriptor) ads.get(i);
                     ad.visitParameterAnnotation(id.intValue(), mv);
                 }
             }
         }

         mv.visitMaxs(0, 0);
View Full Code Here

Examples of org.hibernate.annotationfactory.AnnotationDescriptor

  private AnnotationProxy ann;
  private AnnotationDescriptor descriptor;

  public void setUp() {
    descriptor = new AnnotationDescriptor( TestAnnotation.class );
    descriptor.setValue( "stringElement", "x" );
    descriptor.setValue( "booleanElement", false );
    descriptor.setValue( "someOtherElement", "y" );
    ann = new AnnotationProxy( descriptor );
  }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

    List<Element> elements = tree == null ?
        new ArrayList<Element>() :
        (List<Element>) tree.elements( "secondary-table" );
    List<SecondaryTable> secondaryTables = new ArrayList<SecondaryTable>( 3 );
    for ( Element element : elements ) {
      AnnotationDescriptor annotation = new AnnotationDescriptor( SecondaryTable.class );
      copyStringAttribute( annotation, element, "name", false );
      copyStringAttribute( annotation, element, "catalog", false );
      if ( StringHelper.isNotEmpty( defaults.getCatalog() )
          && StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) ) {
        annotation.setValue( "catalog", defaults.getCatalog() );
      }
      copyStringAttribute( annotation, element, "schema", false );
      if ( StringHelper.isNotEmpty( defaults.getSchema() )
          && StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) {
        annotation.setValue( "schema", defaults.getSchema() );
      }
      buildUniqueConstraints( annotation, element );
      annotation.setValue( "pkJoinColumns", buildPrimaryKeyJoinColumns( element ) );
      secondaryTables.add( (SecondaryTable) AnnotationFactory.create( annotation ) );
    }
    /*
     * You can't have both secondary table in XML and Java,
     * since there would be no way to "remove" a secondary table
     */
    if ( secondaryTables.size() == 0 && defaults.canUseJavaAnnotations() ) {
      SecondaryTable secTableAnn = getJavaAnnotation( SecondaryTable.class );
      overridesDefaultInSecondaryTable( secTableAnn, defaults, secondaryTables );
      SecondaryTables secTablesAnn = getJavaAnnotation( SecondaryTables.class );
      if ( secTablesAnn != null ) {
        for ( SecondaryTable table : secTablesAnn.value() ) {
          overridesDefaultInSecondaryTable( table, defaults, secondaryTables );
        }
      }
    }
    if ( secondaryTables.size() > 0 ) {
      AnnotationDescriptor descriptor = new AnnotationDescriptor( SecondaryTables.class );
      descriptor.setValue( "value", secondaryTables.toArray( new SecondaryTable[secondaryTables.size()] ) );
      return AnnotationFactory.create( descriptor );
    }
    else {
      return null;
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

  ) {
    if ( secTableAnn != null ) {
      //handle default values
      if ( StringHelper.isNotEmpty( defaults.getCatalog() )
          || StringHelper.isNotEmpty( defaults.getSchema() ) ) {
        AnnotationDescriptor annotation = new AnnotationDescriptor( SecondaryTable.class );
        annotation.setValue( "name", secTableAnn.name() );
        annotation.setValue( "schema", secTableAnn.schema() );
        annotation.setValue( "catalog", secTableAnn.catalog() );
        annotation.setValue( "uniqueConstraints", secTableAnn.uniqueConstraints() );
        annotation.setValue( "pkJoinColumns", secTableAnn.pkJoinColumns() );
        if ( StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) )
            && StringHelper.isNotEmpty( defaults.getSchema() ) ) {
          annotation.setValue( "schema", defaults.getSchema() );
        }
        if ( StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) )
            && StringHelper.isNotEmpty( defaults.getCatalog() ) ) {
          annotation.setValue( "catalog", defaults.getCatalog() );
        }
        secondaryTables.add( (SecondaryTable) AnnotationFactory.create( annotation ) );
      }
      else {
        secondaryTables.add( secTableAnn );
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

      Iterator it = columnNamesElements.listIterator();
      while ( it.hasNext() ) {
        Element columnNameElt = (Element) it.next();
        columnNames[columnNameIndex++] = columnNameElt.getTextTrim();
      }
      AnnotationDescriptor ucAnn = new AnnotationDescriptor( UniqueConstraint.class );
      copyStringAttribute( ucAnn, subelement, "name", false );
      ucAnn.setValue( "columnNames", columnNames );
      uniqueConstraints[ucIndex++] = AnnotationFactory.create( ucAnn );
    }
    annotation.setValue( "uniqueConstraints", uniqueConstraints );
  }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

    PrimaryKeyJoinColumn[] pkJoinColumns = new PrimaryKeyJoinColumn[pkJoinColumnElementList.size()];
    int index = 0;
    Iterator pkIt = pkJoinColumnElementList.listIterator();
    while ( pkIt.hasNext() ) {
      Element subelement = (Element) pkIt.next();
      AnnotationDescriptor pkAnn = new AnnotationDescriptor( PrimaryKeyJoinColumn.class );
      copyStringAttribute( pkAnn, subelement, "name", false );
      copyStringAttribute( pkAnn, subelement, "referenced-column-name", false );
      copyStringAttribute( pkAnn, subelement, "column-definition", false );
      pkJoinColumns[index++] = AnnotationFactory.create( pkAnn );
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

  private void processEventAnnotations(List<Annotation> annotationList, XMLContext.Default defaults) {
    boolean eventElement = false;
    for ( Element element : elementsForProperty ) {
      String elementName = element.getName();
      if ( "pre-persist".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PrePersist.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "pre-remove".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PreRemove.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "pre-update".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PreUpdate.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "post-persist".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PostPersist.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "post-remove".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PostRemove.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "post-update".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PostUpdate.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
      else if ( "post-load".equals( elementName ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PostLoad.class );
        annotationList.add( AnnotationFactory.create( ad ) );
        eventElement = true;
      }
    }
    if ( !eventElement && defaults.canUseJavaAnnotations() ) {
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

          throw new AnnotationException(
              "Unable to find " + element.getPath() + ".class: " + className, e
          );
        }
      }
      AnnotationDescriptor ad = new AnnotationDescriptor( EntityListeners.class );
      ad.setValue( "value", entityListenerClasses.toArray( new Class[entityListenerClasses.size()] ) );
      return AnnotationFactory.create( ad );
    }
    else if ( defaults.canUseJavaAnnotations() ) {
      return getJavaAnnotation( EntityListeners.class );
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

        );
    final Class<JoinTable> annotationType = JoinTable.class;
    if ( defaultToJoinTable
        && ( StringHelper.isNotEmpty( defaults.getCatalog() )
        || StringHelper.isNotEmpty( defaults.getSchema() ) ) ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( annotationType );
      if ( defaults.canUseJavaAnnotations() ) {
        JoinTable table = getJavaAnnotation( annotationType );
        if ( table != null ) {
          ad.setValue( "name", table.name() );
          ad.setValue( "schema", table.schema() );
          ad.setValue( "catalog", table.catalog() );
          ad.setValue( "uniqueConstraints", table.uniqueConstraints() );
          ad.setValue( "joinColumns", table.joinColumns() );
          ad.setValue( "inverseJoinColumns", table.inverseJoinColumns() );
        }
      }
      if ( StringHelper.isEmpty( (String) ad.valueOf( "schema" ) )
          && StringHelper.isNotEmpty( defaults.getSchema() ) ) {
        ad.setValue( "schema", defaults.getSchema() );
      }
      if ( StringHelper.isEmpty( (String) ad.valueOf( "catalog" ) )
          && StringHelper.isNotEmpty( defaults.getCatalog() ) ) {
        ad.setValue( "catalog", defaults.getCatalog() );
      }
      return AnnotationFactory.create( ad );
    }
    else if ( defaults.canUseJavaAnnotations() ) {
      return getJavaAnnotation( annotationType );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.