コード例 #1
0
    public OptionsServiceContextImpl(List<OptionValueSource> sources) {
      this.sources = sources;

      globalOptions = OptionsContextImpl.forGlobal(sources);
      entityContexts = new ConcurrentHashMap<Class<?>, OptionsContext>();
      propertyContexts = new ConcurrentHashMap<PropertyKey, OptionsContext>();
    }
コード例 #2
0
    private OptionsContext getAndCacheEntityOptions(Class<?> entityType) {
      OptionsContext entityOptions = OptionsContextImpl.forEntity(sources, entityType);

      OptionsContext cachedOptions = entityContexts.putIfAbsent(entityType, entityOptions);
      if (cachedOptions != null) {
        entityOptions = cachedOptions;
      }

      return entityOptions;
    }
コード例 #3
0
    private OptionsContext getAndCachePropertyOptions(PropertyKey key) {
      OptionsContext propertyOptions =
          OptionsContextImpl.forProperty(sources, key.getEntity(), key.getProperty());

      OptionsContext cachedOptions = propertyContexts.putIfAbsent(key, propertyOptions);
      if (cachedOptions != null) {
        propertyOptions = cachedOptions;
      }

      return propertyOptions;
    }