Examples of AnnotationInstance


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

Examples of org.jboss.jandex.AnnotationInstance

    }
    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

Examples of org.jboss.jandex.AnnotationInstance

    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

Examples of org.jboss.jandex.AnnotationInstance

  }

  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

Examples of org.jboss.jandex.AnnotationInstance

    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

Examples of org.jboss.jandex.AnnotationInstance

    );
    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

Examples of org.jboss.jandex.AnnotationInstance

    }
  }

  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

Examples of org.jboss.jandex.AnnotationInstance

      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

Examples of org.jboss.jandex.AnnotationInstance

    this.name = name;
    this.attributeType = attributeType;
    this.accessType = accessType;

    //if this attribute has either @Id or @EmbeddedId, then it is an id attribute
    AnnotationInstance idAnnotation = JandexHelper.getSingleAnnotation( annotations, JPADotNames.ID );
    AnnotationInstance embeddedIdAnnotation = JandexHelper.getSingleAnnotation(
        annotations,
        JPADotNames.EMBEDDED_ID
    );
    isId = ( idAnnotation != null || embeddedIdAnnotation != null );

    AnnotationInstance columnAnnotation = JandexHelper.getSingleAnnotation(
        annotations,
        JPADotNames.COLUMN
    );
    columnValues = new ColumnValues( columnAnnotation );
View Full Code Here

Examples of org.jboss.jandex.AnnotationInstance

  public abstract PropertyGeneration getPropertyGeneration();

  private boolean checkOptimisticLockAnnotation() {
    boolean triggersVersionIncrement = true;
    AnnotationInstance optimisticLockAnnotation = JandexHelper.getSingleAnnotation(
        annotations(),
        HibernateDotNames.OPTIMISTIC_LOCK
    );
    if ( optimisticLockAnnotation != null ) {
      boolean exclude = optimisticLockAnnotation.value( "excluded" ).asBoolean();
      triggersVersionIncrement = !exclude;
    }
    return triggersVersionIncrement;
  }
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.