Package org.hibernate.ogm.options.spi

Examples of org.hibernate.ogm.options.spi.OptionsContainer


      String propertyName = ReflectionHelper.getPropertyName( method );
      if ( propertyName == null ) {
        continue;
      }

      final OptionsContainer optionsOfProperty = convertOptionAnnotations( method.getAnnotations() );
      optionsByProperty.put( new PropertyKey( entityClass, propertyName ), optionsOfProperty );
    }

    for ( final Field field : entityClass.getDeclaredFields() ) {
      PropertyKey key = new PropertyKey( entityClass, field.getName() );
      OptionsContainer optionsOfField = convertOptionAnnotations( field.getAnnotations() );

      OptionsContainer optionsOfProperty = optionsByProperty.get( key );
      if ( optionsOfProperty != null ) {
        optionsOfProperty.addAll( optionsOfField );
      }
      else {
        optionsByProperty.put( key, optionsOfField );
      }
    }
View Full Code Here


    return optionsByProperty;
  }

  private static OptionsContainer convertOptionAnnotations(Annotation[] annotations) {
    OptionsContainer options = new OptionsContainer();

    for ( Annotation annotation : annotations ) {
      processAnnotation( options, annotation );
    }
View Full Code Here

  public <V> void addGlobalOption(Option<?, V> option, V value) {
    add( option, value, globaloptions );
  }

  public <V> void addEntityOption(Class<?> entityType, Option<?, V> option, V value) {
    OptionsContainer entityOptions = optionsPerEntity.get( entityType );

    if ( entityOptions == null ) {
      entityOptions = getAndCacheAnnotationBasedEntityOptions( entityType );
    }
View Full Code Here

    add( option, value, entityOptions );
  }

  public <V> void addPropertyOption(Class<?> entityType, String propertyName, Option<?, V> option, V value) {
    PropertyKey key = new PropertyKey( entityType, propertyName );
    OptionsContainer propertyOptions = optionsPerProperty.get( key );

    if ( propertyOptions == null ) {
      propertyOptions = getAndCacheAnnotationBasedPropertyOptions( key );
    }
View Full Code Here

    return copy( globaloptions );
  }

  @Override
  public OptionsContainer getEntityOptions(Class<?> entityType) {
    OptionsContainer entityOptions = optionsPerEntity.get( entityType );

    if (entityOptions == null ) {
      entityOptions = getAndCacheAnnotationBasedEntityOptions( entityType );
    }
View Full Code Here

  @Override
  public OptionsContainer getPropertyOptions(Class<?> entityType, String propertyName) {
    PropertyKey key = new PropertyKey( entityType, propertyName );

    OptionsContainer propertyOptions = optionsPerProperty.get( key );

    if (propertyOptions == null ) {
      propertyOptions = getAndCacheAnnotationBasedPropertyOptions( key );
    }
View Full Code Here

  }

  private OptionsContainer copy(OptionsContainer container) {
    //TODO only needed for SF-scoped context?
    synchronized ( container ) {
      return new OptionsContainer( container );
    }
  }
View Full Code Here

   *
   * @param entityType the entity type for which to return the options
   * @return a container with the annotation-based options for the given entity, never {@code null}.
   */
  private OptionsContainer getAndCacheAnnotationBasedEntityOptions(Class<?> entityType) {
    OptionsContainer entityOptions = AnnotationProcessor.getEntityOptions( entityType );

    OptionsContainer cachedOptions = optionsPerEntity.putIfAbsent( entityType, entityOptions );
    if ( cachedOptions != null ) {
      entityOptions = cachedOptions;
    }

    return entityOptions;
View Full Code Here

    for ( Entry<PropertyKey, OptionsContainer> option : allPropertyOptions.entrySet() ) {
      optionsPerProperty.putIfAbsent( option.getKey(), option.getValue() );
    }

    OptionsContainer propertyOptions = optionsPerProperty.get( key );

    //cache an empty container in case the given property has no annotation based options
    if ( propertyOptions == null ) {
      propertyOptions = new OptionsContainer();
      OptionsContainer cachedOptions = optionsPerProperty.putIfAbsent( key, propertyOptions );
      if ( cachedOptions != null ) {
        propertyOptions = cachedOptions;
      }
    }
View Full Code Here

  public void addGlobalOption(Option<?> option) {
    add( option, globaloptions );
  }

  public void addEntityOption(Class<?> entityType, Option<?> option) {
    OptionsContainer entityOptions = optionsPerEntity.get( entityType );

    if ( entityOptions == null ) {
      entityOptions = getAndCacheAnnotationBasedEntityOptions( entityType );
    }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.options.spi.OptionsContainer

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.