test_class.file: server/src/test/java/io/spine/server/model/ModelTest.java
test_class.identifier: ModelTest
test_case.body: @Test
      @DisplayName("find BoundedContext package annotation")
      void findBoundedContextAnnotation() {
          Optional<BoundedContextName> ctx1 = Model.findContext(Counter.class);
          Optional<BoundedContextName> ctx2 = Model.findContext(Encounter.class);
          assertTrue(ctx1.isPresent());
          assertEquals("Counting", ctx1.get()
                                       .getValue());
          assertEquals(ctx1, ctx2);
      }
test_case.class_method_signature: ModelTest.findBoundedContextAnnotation()
test_case.full_signature: @Test @DisplayName("find BoundedContext package annotation") void findBoundedContextAnnotation()
test_case.identifier: findBoundedContextAnnotation
test_case.invocations: findContext findContext assertTrue isPresent assertEquals getValue get assertEquals
test_case.modifiers: @Test @DisplayName("find BoundedContext package annotation")
test_case.parameters: ()
test_case.return: void
test_case.signature: void findBoundedContextAnnotation()
focal_class.declarator: models = newConcurrentMap()
focal_class.modifier: private static final
focal_class.original_string: private static final Map<Class<?>, Model> models = newConcurrentMap();
focal_class.type: Map<Class<?>, Model>
focal_class.var_name: models
focal_class.declarator: knownContexts =
              CacheBuilder.newBuilder().maximumSize(500).build()
focal_class.modifier: private static final
focal_class.original_string: private static final Cache<ClassName, Optional<BoundedContextName>> knownContexts =
              CacheBuilder.newBuilder().maximumSize(500).build();
focal_class.type: Cache<ClassName, Optional<BoundedContextName>>
focal_class.var_name: knownContexts
focal_class.declarator: context
focal_class.modifier: private final
focal_class.original_string: private final BoundedContextName context;
focal_class.type: BoundedContextName
focal_class.var_name: context
focal_class.declarator: classes = new ClassMap()
focal_class.modifier: private final
focal_class.original_string: private final ClassMap classes = new ClassMap();
focal_class.type: ClassMap
focal_class.var_name: classes
focal_class.file: server/src/main/java/io/spine/server/model/Model.java
focal_class.identifier: Model
focal_class.class_method_signature: Model.Model(BoundedContextName context)
focal_class.full_signature: private  Model(BoundedContextName context)
focal_class.identifier: Model
focal_class.modifiers: private
focal_class.parameters: (BoundedContextName context)
focal_class.signature:  Model(BoundedContextName context)
focal_class.class_method_signature: Model.inContextOf(Class<? extends T> rawClass)
focal_class.full_signature: public static synchronized Model inContextOf(Class<? extends T> rawClass)
focal_class.identifier: inContextOf
focal_class.modifiers: public static synchronized
focal_class.parameters: (Class<? extends T> rawClass)
focal_class.return: Model
focal_class.signature: Model inContextOf(Class<? extends T> rawClass)
focal_class.class_method_signature: Model.findContext(Class<? extends T> rawClass)
focal_class.full_signature: @VisibleForTesting static Optional<BoundedContextName> findContext(Class<? extends T> rawClass)
focal_class.identifier: findContext
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (Class<? extends T> rawClass)
focal_class.return: Optional<BoundedContextName>
focal_class.signature: Optional<BoundedContextName> findContext(Class<? extends T> rawClass)
focal_class.class_method_signature: Model.contextName()
focal_class.full_signature: public BoundedContextName contextName()
focal_class.identifier: contextName
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: BoundedContextName
focal_class.signature: BoundedContextName contextName()
focal_class.class_method_signature: Model.clear()
focal_class.full_signature: private void clear()
focal_class.identifier: clear
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clear()
focal_class.class_method_signature: Model.reset()
focal_class.full_signature: private static void reset()
focal_class.identifier: reset
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void reset()
focal_class.class_method_signature: Model.dropAllModels()
focal_class.full_signature: @VisibleForTesting public static synchronized void dropAllModels()
focal_class.identifier: dropAllModels
focal_class.modifiers: @VisibleForTesting public static synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void dropAllModels()
focal_class.class_method_signature: Model.getClass(Class<? extends T> cls,
                             Class<M> classOfModelClass,
                             Supplier<ModelClass<T>> supplier)
focal_class.full_signature:  ModelClass<T> getClass(Class<? extends T> cls,
                             Class<M> classOfModelClass,
                             Supplier<ModelClass<T>> supplier)
focal_class.identifier: getClass
focal_class.parameters: (Class<? extends T> cls,
                             Class<M> classOfModelClass,
                             Supplier<ModelClass<T>> supplier)
focal_class.return: ModelClass<T>
focal_class.signature: ModelClass<T> getClass(Class<? extends T> cls,
                             Class<M> classOfModelClass,
                             Supplier<ModelClass<T>> supplier)
focal_method.body: @VisibleForTesting
      static <T> Optional<BoundedContextName> findContext(Class<? extends T> rawClass) {
          ClassName clazzName = ClassName.of(rawClass);
          try {
              return knownContexts.get(clazzName, () -> {
                  Optional<BoundedContextName> result;
  
                  PackageInfo pkg = PackageInfo.of(rawClass);
                  Optional<BoundedContext> annotation = pkg.findAnnotation(BoundedContext.class);
                  if (!annotation.isPresent()) {
                      result = Optional.empty();
                  } else {
                      String nameAsString = annotation.get()
                                                      .value();
                      BoundedContextName contextName = BoundedContextNames.newName(nameAsString);
                      result = Optional.of(contextName);
                  }
                  return result;
              });
          } catch (ExecutionException e) {
              throw illegalStateWithCauseOf(e);
          }
      }
focal_method.class_method_signature: Model.findContext(Class<? extends T> rawClass)
focal_method.full_signature: @VisibleForTesting static Optional<BoundedContextName> findContext(Class<? extends T> rawClass)
focal_method.identifier: findContext
focal_method.invocations: of get of findAnnotation isPresent empty value get newName of illegalStateWithCauseOf
focal_method.modifiers: @VisibleForTesting static
focal_method.parameters: (Class<? extends T> rawClass)
focal_method.return: Optional<BoundedContextName>
focal_method.signature: Optional<BoundedContextName> findContext(Class<? extends T> rawClass)