Examples of OptionsContainer


Examples of org.hibernate.ogm.options.container.impl.OptionsContainer

   * @param optionType the option type of interest
   * @return the container which effectively contributes the given option's value; May be an empty container in case
   * no value at all is configured for the given option, but never {@code null}
   */
  private <I, V, O extends Option<I, V>> OptionsContainer getMostSpecificContainer(Class<O> optionType) {
    OptionsContainer container;

    if ( propertyName != null ) {
      for ( Class<?> clazz : hierarchy ) {
        for ( OptionValueSource source : sources ) {
          container = source.getPropertyOptions( clazz, propertyName );
          if ( !container.getAll( optionType ).isEmpty() ) {
            return container;
          }
        }
      }
    }

    if ( entityType != null ) {
      for ( Class<?> clazz : hierarchy ) {
        for ( OptionValueSource source : sources ) {
          container = source.getEntityOptions( clazz );
          if ( !container.getAll( optionType ).isEmpty() ) {
            return container;
          }
        }
      }
    }

    for ( OptionValueSource source : sources ) {
      container = source.getGlobalOptions();
      if ( !container.getAll( optionType ).isEmpty() ) {
        return container;
      }
    }

    return OptionsContainer.EMPTY;
View Full Code Here

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer

    return new OptionsContextImpl( sources, entityType, null );
  }

  @Override
  public <I, V, O extends Option<I, V>> V get(Class<O> optionType, I identifier) {
    OptionsContainer optionsContainer = optionCache.get( optionType );

    if ( optionsContainer == null ) {
      optionsContainer = getAndCacheOptionsContainer( optionType );
    }

    return optionsContainer.get( optionType, identifier );
  }
View Full Code Here

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer

    return optionsContainer.get( optionType, identifier );
  }

  @Override
  public <V, O extends UniqueOption<V>> V getUnique(Class<O> optionType) {
    OptionsContainer optionsContainer = optionCache.get( optionType );

    if ( optionsContainer == null ) {
      optionsContainer = getAndCacheOptionsContainer( optionType );
    }

    return optionsContainer.getUnique( optionType );
  }
View Full Code Here

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer

    return optionsContainer.getUnique( optionType );
  }

  @Override
  public <I, V, O extends Option<I, V>> Map<I, V> getAll(Class<O> optionType) {
    OptionsContainer optionsContainer = optionCache.get( optionType );

    if ( optionsContainer == null ) {
      optionsContainer = getAndCacheOptionsContainer( optionType );
    }

    return optionsContainer.getAll( optionType );
  }
View Full Code Here

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer

    return optionsContainer.getAll( optionType );
  }

  private <I, V, O extends Option<I, V>> OptionsContainer getAndCacheOptionsContainer(Class<O> optionType) {
    OptionsContainer container = getMostSpecificContainer( optionType );

    OptionsContainer cachedContainer = optionCache.putIfAbsent( optionType, container );
    if ( cachedContainer != null ) {
      container = cachedContainer;
    }

    return container;
View Full Code Here

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer

   * @param optionType the option type of interest
   * @return the container which effectively contributes the given option's value; May be an empty container in case
   * no value at all is configured for the given option, but never {@code null}
   */
  private <I, V, O extends Option<I, V>> OptionsContainer getMostSpecificContainer(Class<O> optionType) {
    OptionsContainer container;

    if ( propertyName != null ) {
      for ( Class<?> clazz : hierarchy ) {
        for ( OptionValueSource source : sources ) {
          container = source.getPropertyOptions( clazz, propertyName );
          if ( !container.getAll( optionType ).isEmpty() ) {
            return container;
          }
        }
      }
    }

    if ( entityType != null ) {
      for ( Class<?> clazz : hierarchy ) {
        for ( OptionValueSource source : sources ) {
          container = source.getEntityOptions( clazz );
          if ( !container.getAll( optionType ).isEmpty() ) {
            return container;
          }
        }
      }
    }

    for ( OptionValueSource source : sources ) {
      container = source.getGlobalOptions();
      if ( !container.getAll( optionType ).isEmpty() ) {
        return container;
      }
    }

    return OptionsContainer.EMPTY;
View Full Code Here

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer

    return globalOptions;
  }

  @Override
  public OptionsContainer getEntityOptions(Class<?> entityType) {
    OptionsContainer entityOptions = optionsPerEntity.get( entityType );
    return entityOptions != null ? entityOptions : OptionsContainer.EMPTY;
  }
View Full Code Here

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer

    return entityOptions != null ? entityOptions : OptionsContainer.EMPTY;
  }

  @Override
  public OptionsContainer getPropertyOptions(Class<?> entityType, String propertyName) {
    OptionsContainer propertyOptions = optionsPerProperty.get( new PropertyKey( entityType, propertyName ) );
    return propertyOptions != null ? propertyOptions : OptionsContainer.EMPTY;
  }
View Full Code Here

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer

    return globalOptions;
  }

  @Override
  public OptionsContainer getEntityOptions(Class<?> entityType) {
    OptionsContainer entityOptions = optionsPerEntity.get( entityType );
    return entityOptions != null ? entityOptions : OptionsContainer.EMPTY;
  }
View Full Code Here

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer

    return entityOptions != null ? entityOptions : OptionsContainer.EMPTY;
  }

  @Override
  public OptionsContainer getPropertyOptions(Class<?> entityType, String propertyName) {
    OptionsContainer propertyOptions = optionsPerProperty.get( new PropertyKey( entityType, propertyName ) );
    return propertyOptions != null ? propertyOptions : OptionsContainer.EMPTY;
  }
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.