test_class.declarator: thrown = ExpectedException.none()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public ExpectedException thrown = ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: thrown
test_class.declarator: groovyClassLoader = new GroovyClassLoader()
test_class.modifier: private
test_class.original_string: private GroovyClassLoader groovyClassLoader = new GroovyClassLoader();
test_class.type: GroovyClassLoader
test_class.var_name: groovyClassLoader
test_class.file: everrest-core/src/test/java/org/everrest/core/impl/provider/json/ObjectBuilderTest.java
test_class.identifier: ObjectBuilderTest
test_case.body: @Test
      public void createsSetOfObjects() throws Exception {
          ArrayValue jsonArray = createJsonArray(createJsonBook(createJunitBook()),
                                                 createJsonBook(createCSharpBook())
                                                );
          Set set = ObjectBuilder.createCollection(Set.class, newParameterizedType(Set.class, Book.class), jsonArray);
          assertEquals(newHashSet(createJunitBook(), createCSharpBook()), set);
      }
test_case.class_method_signature: ObjectBuilderTest.createsSetOfObjects()
test_case.full_signature: @Test public void createsSetOfObjects()
test_case.identifier: createsSetOfObjects
test_case.invocations: createJsonArray createJsonBook createJunitBook createJsonBook createCSharpBook createCollection newParameterizedType assertEquals newHashSet createJunitBook createCSharpBook
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void createsSetOfObjects()
focal_class.declarator: SKIP_METHODS = newHashSet("setMetaClass")
focal_class.modifier: private static final
focal_class.original_string: private static final Collection<String> SKIP_METHODS = newHashSet("setMetaClass");
focal_class.type: Collection<String>
focal_class.var_name: SKIP_METHODS
focal_class.declarator: methodsCache = CacheBuilder.newBuilder()
                                                                                     .concurrencyLevel(8)
                                                                                     .maximumSize(256)
                                                                                     .expireAfterAccess(10, MINUTES)
                                                                                     .build(new CacheLoader<Class<?>, JsonMethod[]>() {
                                                                                         @Override
                                                                                         public JsonMethod[] load(Class<?> aClass)
                                                                                                 throws Exception {
                                                                                             return getJsonMethods(aClass);
                                                                                         }
                                                                                     })
focal_class.modifier: private static
focal_class.original_string: private static LoadingCache<Class<?>, JsonMethod[]> methodsCache = CacheBuilder.newBuilder()
                                                                                     .concurrencyLevel(8)
                                                                                     .maximumSize(256)
                                                                                     .expireAfterAccess(10, MINUTES)
                                                                                     .build(new CacheLoader<Class<?>, JsonMethod[]>() {
                                                                                         @Override
                                                                                         public JsonMethod[] load(Class<?> aClass)
                                                                                                 throws Exception {
                                                                                             return getJsonMethods(aClass);
                                                                                         }
                                                                                     });
focal_class.type: LoadingCache<Class<?>, JsonMethod[]>
focal_class.var_name: methodsCache
focal_class.declarator: constructorsCache = CacheBuilder.newBuilder()
                                                                                     .concurrencyLevel(8)
                                                                                     .maximumSize(256)
                                                                                     .expireAfterAccess(10, MINUTES)
                                                                                     .build()
focal_class.modifier: private static
focal_class.original_string: private static Cache<Class<?>, Constructor<?>> constructorsCache = CacheBuilder.newBuilder()
                                                                                     .concurrencyLevel(8)
                                                                                     .maximumSize(256)
                                                                                     .expireAfterAccess(10, MINUTES)
                                                                                     .build();
focal_class.type: Cache<Class<?>, Constructor<?>>
focal_class.var_name: constructorsCache
focal_class.file: everrest-core/src/main/java/org/everrest/core/impl/provider/json/ObjectBuilder.java
focal_class.identifier: ObjectBuilder
focal_class.class_method_signature: ObjectBuilder.getJsonMethods(Class<?> clazz)
focal_class.full_signature: private static JsonMethod[] getJsonMethods(Class<?> clazz)
focal_class.identifier: getJsonMethods
focal_class.modifiers: private static
focal_class.parameters: (Class<?> clazz)
focal_class.return: JsonMethod[]
focal_class.signature: JsonMethod[] getJsonMethods(Class<?> clazz)
focal_class.class_method_signature: ObjectBuilder.shouldBeProcessed(Method method)
focal_class.full_signature: private static boolean shouldBeProcessed(Method method)
focal_class.identifier: shouldBeProcessed
focal_class.modifiers: private static
focal_class.parameters: (Method method)
focal_class.return: boolean
focal_class.signature: boolean shouldBeProcessed(Method method)
focal_class.class_method_signature: ObjectBuilder.isSetter(Method method)
focal_class.full_signature: private static boolean isSetter(Method method)
focal_class.identifier: isSetter
focal_class.modifiers: private static
focal_class.parameters: (Method method)
focal_class.return: boolean
focal_class.signature: boolean isSetter(Method method)
focal_class.class_method_signature: ObjectBuilder.createArray(Class<?> aClass, JsonValue jsonArray)
focal_class.full_signature: public static Object createArray(Class<?> aClass, JsonValue jsonArray)
focal_class.identifier: createArray
focal_class.modifiers: public static
focal_class.parameters: (Class<?> aClass, JsonValue jsonArray)
focal_class.return: Object
focal_class.signature: Object createArray(Class<?> aClass, JsonValue jsonArray)
focal_class.class_method_signature: ObjectBuilder.createCollection(Class<T> collectionClass, Type genericType, JsonValue jsonArray)
focal_class.full_signature: @SuppressWarnings("unchecked") public static T createCollection(Class<T> collectionClass, Type genericType, JsonValue jsonArray)
focal_class.identifier: createCollection
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (Class<T> collectionClass, Type genericType, JsonValue jsonArray)
focal_class.return: T
focal_class.signature: T createCollection(Class<T> collectionClass, Type genericType, JsonValue jsonArray)
focal_class.class_method_signature: ObjectBuilder.findAcceptableCollectionImplementation(Class<T> collectionClass)
focal_class.full_signature: private static Class findAcceptableCollectionImplementation(Class<T> collectionClass)
focal_class.identifier: findAcceptableCollectionImplementation
focal_class.modifiers: private static
focal_class.parameters: (Class<T> collectionClass)
focal_class.return: Class
focal_class.signature: Class findAcceptableCollectionImplementation(Class<T> collectionClass)
focal_class.class_method_signature: ObjectBuilder.createObject(Class<T> mapClass, Type genericType, JsonValue jsonObject)
focal_class.full_signature: @SuppressWarnings("unchecked") public static T createObject(Class<T> mapClass, Type genericType, JsonValue jsonObject)
focal_class.identifier: createObject
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (Class<T> mapClass, Type genericType, JsonValue jsonObject)
focal_class.return: T
focal_class.signature: T createObject(Class<T> mapClass, Type genericType, JsonValue jsonObject)
focal_class.class_method_signature: ObjectBuilder.findAcceptableMapImplementation(Class<T> mapClass)
focal_class.full_signature: private static Class findAcceptableMapImplementation(Class<T> mapClass)
focal_class.identifier: findAcceptableMapImplementation
focal_class.modifiers: private static
focal_class.parameters: (Class<T> mapClass)
focal_class.return: Class
focal_class.signature: Class findAcceptableMapImplementation(Class<T> mapClass)
focal_class.class_method_signature: ObjectBuilder.createObject(Class<T> aClass, JsonValue jsonValue)
focal_class.full_signature: @SuppressWarnings({"unchecked"}) public static T createObject(Class<T> aClass, JsonValue jsonValue)
focal_class.identifier: createObject
focal_class.modifiers: @SuppressWarnings({"unchecked"}) public static
focal_class.parameters: (Class<T> aClass, JsonValue jsonValue)
focal_class.return: T
focal_class.signature: T createObject(Class<T> aClass, JsonValue jsonValue)
focal_class.class_method_signature: ObjectBuilder.mergeMessagesFromCausalJsonExceptions(Throwable error, StringBuilder msg)
focal_class.full_signature: private static void mergeMessagesFromCausalJsonExceptions(Throwable error, StringBuilder msg)
focal_class.identifier: mergeMessagesFromCausalJsonExceptions
focal_class.modifiers: private static
focal_class.parameters: (Throwable error, StringBuilder msg)
focal_class.return: void
focal_class.signature: void mergeMessagesFromCausalJsonExceptions(Throwable error, StringBuilder msg)
focal_class.class_method_signature: ObjectBuilder.getConstructor(Class<T> aClass, Class<?>... parameters)
focal_class.full_signature: @SuppressWarnings("unchecked") private static Constructor<T> getConstructor(Class<T> aClass, Class<?>... parameters)
focal_class.identifier: getConstructor
focal_class.modifiers: @SuppressWarnings("unchecked") private static
focal_class.parameters: (Class<T> aClass, Class<?>... parameters)
focal_class.return: Constructor<T>
focal_class.signature: Constructor<T> getConstructor(Class<T> aClass, Class<?>... parameters)
focal_class.class_method_signature: ObjectBuilder.createEnum(Class enumClass, JsonValue jsonValue)
focal_class.full_signature: @SuppressWarnings("unchecked") private static Enum<?> createEnum(Class enumClass, JsonValue jsonValue)
focal_class.identifier: createEnum
focal_class.modifiers: @SuppressWarnings("unchecked") private static
focal_class.parameters: (Class enumClass, JsonValue jsonValue)
focal_class.return: Enum<?>
focal_class.signature: Enum<?> createEnum(Class enumClass, JsonValue jsonValue)
focal_class.class_method_signature: ObjectBuilder.createObjectKnownTypes(Class<?> aClass, JsonValue jsonValue)
focal_class.full_signature: private static Object createObjectKnownTypes(Class<?> aClass, JsonValue jsonValue)
focal_class.identifier: createObjectKnownTypes
focal_class.modifiers: private static
focal_class.parameters: (Class<?> aClass, JsonValue jsonValue)
focal_class.return: Object
focal_class.signature: Object createObjectKnownTypes(Class<?> aClass, JsonValue jsonValue)
focal_class.class_method_signature: ObjectBuilder.ObjectBuilder()
focal_class.full_signature: private  ObjectBuilder()
focal_class.identifier: ObjectBuilder
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  ObjectBuilder()
focal_method.body: @SuppressWarnings("unchecked")
      public static <T extends Collection<?>> T createCollection(Class<T> collectionClass, Type genericType, JsonValue jsonArray)
              throws JsonException {
          if (jsonArray == null || jsonArray.isNull()) {
              return null;
          }
          Class elementClass;
          Type elementType;
          if (genericType instanceof ParameterizedType) {
              ParameterizedType parameterizedType = (ParameterizedType)genericType;
              elementType = parameterizedType.getActualTypeArguments()[0];
              if (elementType instanceof Class) {
                  elementClass = (Class)elementType;
              } else if (elementType instanceof ParameterizedType) {
                  elementClass = (Class)((ParameterizedType)elementType).getRawType();
              } else {
                  throw new JsonException(String.format(
                          "This type of Collection can't be restored from JSON source.\nCollection is parameterized by wrong Type: %s",
                          parameterizedType));
              }
          } else {
              throw new JsonException("Collection is not parameterized. Collection<?> is not supported");
          }
  
          Constructor<? extends T> constructor;
          if (collectionClass.isInterface() || Modifier.isAbstract(collectionClass.getModifiers())) {
              constructor = getConstructor(findAcceptableCollectionImplementation(collectionClass), Collection.class);
          } else {
              constructor = getConstructor(collectionClass, Collection.class);
          }
  
          ArrayList<Object> sourceCollection = new ArrayList<>(jsonArray.size());
          Iterator<JsonValue> values = jsonArray.getElements();
          Types jsonElementType = getType(elementClass);
          while (values.hasNext()) {
              JsonValue value = values.next();
              if (jsonElementType == null) {
                  sourceCollection.add(createObject(elementClass, value));
              } else {
                  switch (jsonElementType) {
                      case BYTE:
                      case SHORT:
                      case INT:
                      case LONG:
                      case FLOAT:
                      case DOUBLE:
                      case BOOLEAN:
                      case CHAR:
                      case STRING:
                      case NULL:
                      case ARRAY_BYTE:
                      case ARRAY_SHORT:
                      case ARRAY_INT:
                      case ARRAY_LONG:
                      case ARRAY_FLOAT:
                      case ARRAY_DOUBLE:
                      case ARRAY_BOOLEAN:
                      case ARRAY_CHAR:
                      case ARRAY_STRING:
                      case CLASS:
                          sourceCollection.add(createObjectKnownTypes(elementClass, value));
                          break;
                      case ARRAY_OBJECT:
                          sourceCollection.add(createArray(elementClass, value));
                          break;
                      case COLLECTION:
                          sourceCollection.add(createCollection(elementClass, elementType, value));
                          break;
                      case MAP:
                          sourceCollection.add(createObject(elementClass, elementType, value));
                          break;
                      case ENUM:
                          sourceCollection.add(createEnum(elementClass, value));
                          break;
                  }
              }
          }
          try {
              return constructor.newInstance(sourceCollection);
          } catch (Exception e) {
              throw new JsonException(e.getMessage(), e);
          }
      }
focal_method.class_method_signature: ObjectBuilder.createCollection(Class<T> collectionClass, Type genericType, JsonValue jsonArray)
focal_method.full_signature: @SuppressWarnings("unchecked") public static T createCollection(Class<T> collectionClass, Type genericType, JsonValue jsonArray)
focal_method.identifier: createCollection
focal_method.invocations: isNull getActualTypeArguments getRawType format isInterface isAbstract getModifiers getConstructor findAcceptableCollectionImplementation getConstructor size getElements getType hasNext next add createObject add createObjectKnownTypes add createArray add createCollection add createObject add createEnum newInstance getMessage
focal_method.modifiers: @SuppressWarnings("unchecked") public static
focal_method.parameters: (Class<T> collectionClass, Type genericType, JsonValue jsonArray)
focal_method.return: T
focal_method.signature: T createCollection(Class<T> collectionClass, Type genericType, JsonValue jsonArray)