Package org.jboss.jandex

Examples of org.jboss.jandex.AnnotationInstance


      isDiscriminatorIncludedInSql = true;
    }
  }

  private void processHibernateEntitySpecificAnnotations() {
    final AnnotationInstance hibernateEntityAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.ENTITY
    );

    // see HHH-6400
    PolymorphismType polymorphism = PolymorphismType.IMPLICIT;
    if ( hibernateEntityAnnotation != null && hibernateEntityAnnotation.value( "polymorphism" ) != null ) {
      polymorphism = PolymorphismType.valueOf( hibernateEntityAnnotation.value( "polymorphism" ).asEnum() );
    }
    isExplicitPolymorphism = polymorphism == PolymorphismType.EXPLICIT;

    // see HHH-6401
    OptimisticLockType optimisticLockType = OptimisticLockType.VERSION;
    if ( hibernateEntityAnnotation != null && hibernateEntityAnnotation.value( "optimisticLock" ) != null ) {
      optimisticLockType = OptimisticLockType.valueOf(
          hibernateEntityAnnotation.value( "optimisticLock" )
              .asEnum()
      );
    }
    optimisticLockStyle = OptimisticLockStyle.valueOf( optimisticLockType.name() );

    final AnnotationInstance hibernateImmutableAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.IMMUTABLE
    );
    isMutable = hibernateImmutableAnnotation == null
        && hibernateEntityAnnotation != null
        && hibernateEntityAnnotation.value( "mutable" ) != null
        && hibernateEntityAnnotation.value( "mutable" ).asBoolean();


    final AnnotationInstance whereAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.WHERE
    );
    whereClause = whereAnnotation != null && whereAnnotation.value( "clause" ) != null ?
        whereAnnotation.value( "clause" ).asString() : null;

    final AnnotationInstance rowIdAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.ROW_ID
    );
    rowId = rowIdAnnotation != null && rowIdAnnotation.value() != null
        ? rowIdAnnotation.value().asString() : null;

    caching = determineCachingSettings();

    // see HHH-6397
    isDynamicInsert =
        hibernateEntityAnnotation != null
            && hibernateEntityAnnotation.value( "dynamicInsert" ) != null
            && hibernateEntityAnnotation.value( "dynamicInsert" ).asBoolean();

    // see HHH-6398
    isDynamicUpdate =
        hibernateEntityAnnotation != null
            && hibernateEntityAnnotation.value( "dynamicUpdate" ) != null
            && hibernateEntityAnnotation.value( "dynamicUpdate" ).asBoolean();


    // see HHH-6399
    isSelectBeforeUpdate =
        hibernateEntityAnnotation != null
            && hibernateEntityAnnotation.value( "selectBeforeUpdate" ) != null
            && hibernateEntityAnnotation.value( "selectBeforeUpdate" ).asBoolean();

    // Custom persister
    final String entityPersisterClass;
    final AnnotationInstance persisterAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.PERSISTER
    );
    if ( persisterAnnotation == null || persisterAnnotation.value( "impl" ) == null ) {
      if ( hibernateEntityAnnotation != null && hibernateEntityAnnotation.value( "persister" ) != null ) {
        entityPersisterClass = hibernateEntityAnnotation.value( "persister" ).asString();
      }
      else {
        entityPersisterClass = null;
      }
    }
    else {
      if ( hibernateEntityAnnotation != null && hibernateEntityAnnotation.value( "persister" ) != null ) {
        // todo : error?
      }
      entityPersisterClass = persisterAnnotation.value( "impl" ).asString();
    }
    this.customPersister = entityPersisterClass;
  }
View Full Code Here


    }
    this.customPersister = entityPersisterClass;
  }

  private Caching determineCachingSettings() {
    final AnnotationInstance hibernateCacheAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.CACHE
    );
    if ( hibernateCacheAnnotation != null ) {
      final org.hibernate.cache.spi.access.AccessType accessType = hibernateCacheAnnotation.value( "usage" ) == null
          ? getLocalBindingContext().getMappingDefaults().getCacheAccessType()
          : CacheConcurrencyStrategy.parse( hibernateCacheAnnotation.value( "usage" ).asEnum() )
          .toAccessType();
      return new Caching(
          hibernateCacheAnnotation.value( "region" ) == null
              ? getName()
              : hibernateCacheAnnotation.value( "region" ).asString(),
          accessType,
          hibernateCacheAnnotation.value( "include" ) != null
              && "all".equals( hibernateCacheAnnotation.value( "include" ).asString() )
      );
    }

    final AnnotationInstance jpaCacheableAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), JPADotNames.CACHEABLE
    );

    boolean cacheable = true; // true is the default
    if ( jpaCacheableAnnotation != null && jpaCacheableAnnotation.value() != null ) {
      cacheable = jpaCacheableAnnotation.value().asBoolean();
    }

    final boolean doCaching;
    switch ( getLocalBindingContext().getMetadataImplementor().getOptions().getSharedCacheMode() ) {
      case ALL: {
View Full Code Here

    return tableSourceImpl;
  }

  private Set<TableSource> createSecondaryTableSources() {
    Set<TableSource> secondaryTableSources = new HashSet<TableSource>();
    AnnotationInstance secondaryTables = JandexHelper.getSingleAnnotation(
        getClassInfo(),
        JPADotNames.SECONDARY_TABLES
    );
    AnnotationInstance secondaryTable = JandexHelper.getSingleAnnotation(
        getClassInfo(),
        JPADotNames.SECONDARY_TABLE
    );
    // collect all @secondaryTable annotations
    List<AnnotationInstance> secondaryTableAnnotations = new ArrayList<AnnotationInstance>();
View Full Code Here

  }

  private String determineCustomLoader() {
    String customLoader = null;
    // Custom sql loader
    final AnnotationInstance sqlLoaderAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.LOADER
    );
    if ( sqlLoaderAnnotation != null ) {
      customLoader = sqlLoaderAnnotation.value( "namedQuery" ).asString();
    }
    return customLoader;
  }
View Full Code Here

    return new CustomSQL( sql, isCallable, checkStyle );
  }

  private void processCustomSqlAnnotations() {
    // Custom sql insert
    final AnnotationInstance sqlInsertAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.SQL_INSERT
    );
    customInsert = createCustomSQL( sqlInsertAnnotation );

    // Custom sql update
    final AnnotationInstance sqlUpdateAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.SQL_UPDATE
    );
    customUpdate = createCustomSQL( sqlUpdateAnnotation );

    // Custom sql delete
    final AnnotationInstance sqlDeleteAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.SQL_DELETE
    );
    customDelete = createCustomSQL( sqlDeleteAnnotation );
  }
View Full Code Here

    );
    customDelete = createCustomSQL( sqlDeleteAnnotation );
  }

  private List<String> determineSynchronizedTableNames() {
    final AnnotationInstance synchronizeAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.SYNCHRONIZE
    );
    if ( synchronizeAnnotation != null ) {
      final String[] tableNames = synchronizeAnnotation.value().asStringArray();
      return Arrays.asList( tableNames );
    }
    else {
      return Collections.emptyList();
    }
View Full Code Here

    }
  }

  private void processProxyGeneration() {
    // Proxy generation
    final AnnotationInstance hibernateProxyAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.PROXY
    );
    if ( hibernateProxyAnnotation != null ) {
      isLazy = hibernateProxyAnnotation.value( "lazy" ) == null
          || hibernateProxyAnnotation.value( "lazy" ).asBoolean();
      if ( isLazy ) {
        final AnnotationValue proxyClassValue = hibernateProxyAnnotation.value( "proxyClass" );
        if ( proxyClassValue == null ) {
          proxy = getName();
        }
        else {
          proxy = proxyClassValue.asString();
View Full Code Here

      proxy = getName();
    }
  }

  private int determineBatchSize() {
    final AnnotationInstance batchSizeAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.BATCH_SIZE
    );
    return batchSizeAnnotation == null ? -1 : batchSizeAnnotation.value( "size" ).asInt();
  }
View Full Code Here

      CoreMessageLogger.class,
      AccessHelper.class.getName()
  );

  static JaxbAccessType getAccessFromDefault(IndexBuilder indexBuilder) {
    AnnotationInstance annotationInstance = JandexHelper.getSingleAnnotation(
        indexBuilder.getAnnotations(),
        PseudoJpaDotNames.DEFAULT_ACCESS
    );
    if ( annotationInstance == null ) {
      return null;
View Full Code Here

  @Override
  protected void process(DotName annName, AnnotationInstance annotationInstance, List<AnnotationInstance> indexedAnnotationInstanceList) {
    AnnotationTarget target = annotationInstance.target();

    for ( Iterator<AnnotationInstance> iter = indexedAnnotationInstanceList.iterator(); iter.hasNext(); ) {
      AnnotationInstance ann = iter.next();
      if ( MockHelper.targetEquals( target, ann.target() ) ) {
        iter.remove();
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.jboss.jandex.AnnotationInstance

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.