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 createsSimpleGroovyBean() throws Exception {
          Class<?> aClass = parseGroovyClass("SimpleBean.groovy");
          JsonValue jsonObject = createJsonObject("value", new StringValue("test restore groovy bean"));
          GroovyObject simpleBean = (GroovyObject)ObjectBuilder.createObject(aClass, jsonObject);
          assertEquals("test restore groovy bean", simpleBean.invokeMethod("getValue", new Object[0]));
      }
test_case.class_method_signature: ObjectBuilderTest.createsSimpleGroovyBean()
test_case.full_signature: @Test public void createsSimpleGroovyBean()
test_case.identifier: createsSimpleGroovyBean
test_case.invocations: parseGroovyClass createJsonObject createObject assertEquals invokeMethod
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void createsSimpleGroovyBean()
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 Map<String, ?>> T createObject(Class<T> mapClass, Type genericType, JsonValue jsonObject)
              throws JsonException {
          if (jsonObject == null || jsonObject.isNull()) {
              return null;
          }
          Class mapValueClass;
          Type mapValueType;
          if (genericType instanceof ParameterizedType) {
              ParameterizedType parameterizedType = (ParameterizedType)genericType;
              if (!String.class.isAssignableFrom((Class)parameterizedType.getActualTypeArguments()[0])) {
                  throw new JsonException("Key of Map must be String. ");
              }
              mapValueType = parameterizedType.getActualTypeArguments()[1];
              if (mapValueType instanceof Class) {
                  mapValueClass = (Class)mapValueType;
              } else if (mapValueType instanceof ParameterizedType) {
                  mapValueClass = (Class)((ParameterizedType)mapValueType).getRawType();
              } else {
                  throw new JsonException(
                          String.format("This type of Map can't be restored from JSON source.\nMap is parameterized by wrong Type: %s",
                                        parameterizedType));
              }
          } else {
              throw new JsonException("Map is not parameterized. Map<Sting, ?> is not supported.");
          }
          Constructor<? extends T> constructor;
          if (mapClass.isInterface() || Modifier.isAbstract(mapClass.getModifiers())) {
              constructor = getConstructor(findAcceptableMapImplementation(mapClass), Map.class);
          } else {
              constructor = getConstructor(mapClass, Map.class);
          }
  
          Types jsonMapValueType = getType(mapValueClass);
          HashMap<String, Object> sourceMap = new HashMap<>(jsonObject.size());
          Iterator<String> keys = jsonObject.getKeys();
          while (keys.hasNext()) {
              String key = keys.next();
              JsonValue childJsonValue = jsonObject.getElement(key);
              if (jsonMapValueType == null) {
                  sourceMap.put(key, createObject(mapValueClass, childJsonValue));
              } else {
                  switch (jsonMapValueType) {
                      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:
                          sourceMap.put(key, createObjectKnownTypes(mapValueClass, childJsonValue));
                          break;
                      case ARRAY_OBJECT:
                          sourceMap.put(key, createArray(mapValueClass, childJsonValue));
                          break;
                      case COLLECTION:
                          sourceMap.put(key, createCollection(mapValueClass, mapValueType, childJsonValue));
                          break;
                      case MAP:
                          sourceMap.put(key, createObject(mapValueClass, mapValueType, childJsonValue));
                          break;
                      case ENUM:
                          sourceMap.put(key, createEnum(mapValueClass, childJsonValue));
                          break;
                  }
              }
          }
          try {
              return constructor.newInstance(sourceMap);
          } catch (Exception e) {
              throw new JsonException(e.getMessage(), e);
          }
      }
focal_method.class_method_signature: ObjectBuilder.createObject(Class<T> mapClass, Type genericType, JsonValue jsonObject)
focal_method.full_signature: @SuppressWarnings("unchecked") public static T createObject(Class<T> mapClass, Type genericType, JsonValue jsonObject)
focal_method.identifier: createObject
focal_method.invocations: isNull isAssignableFrom getActualTypeArguments getActualTypeArguments getRawType format isInterface isAbstract getModifiers getConstructor findAcceptableMapImplementation getConstructor getType size getKeys hasNext next getElement put createObject put createObjectKnownTypes put createArray put createCollection put createObject put createEnum newInstance getMessage
focal_method.modifiers: @SuppressWarnings("unchecked") public static
focal_method.parameters: (Class<T> mapClass, Type genericType, JsonValue jsonObject)
focal_method.return: T
focal_method.signature: T createObject(Class<T> mapClass, Type genericType, JsonValue jsonObject)