Package org.hibernate.ogm.options.container.impl

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


    configuration
      .entity( ContextExample.class )
        .property( "property", ElementType.FIELD )
          .embed( "Foo" );

    OptionsContainer optionsContainer = getSource().getPropertyOptions( ContextExample.class, "property" );
    assertThat( optionsContainer.getUnique( EmbedExampleOption.class ) ).isEqualTo( "Foo" );
  }
View Full Code Here


    configuration
      .entity( ContextExample.class )
        .property( "property", ElementType.METHOD )
          .embed( "Foo" );

    OptionsContainer optionsContainer = getSource().getPropertyOptions( ContextExample.class, "property" );
    assertThat( optionsContainer.getUnique( EmbedExampleOption.class ) ).isEqualTo( "Foo" );
  }
View Full Code Here

  public void shouldBeAbleToRetrieveUniqueEntityOptionViaGet() throws Exception {
    configuration
      .entity( Refrigerator.class )
        .force( true );

    OptionsContainer refrigatorOptions = getSource().getEntityOptions( Refrigerator.class );
    assertThat( refrigatorOptions.getUnique( ForceExampleOption.class ) ).isTrue();
  }
View Full Code Here

    configuration
      .entity( Refrigerator.class )
        .force( true )
        .force( false );

    OptionsContainer refrigatorOptions = getSource().getEntityOptions( Refrigerator.class );
    assertThat( refrigatorOptions.getUnique( ForceExampleOption.class ) ).isFalse();
  }
View Full Code Here

    return globalOptions;
  }

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

    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

    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

    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

    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

    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

TOP

Related Classes of org.hibernate.ogm.options.container.impl.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.