Register a typeName to Class mapping

@param typeName SQL type name
@param clazz java type
425721
public void registerType(String typeName, Class<?> clazz) {
        typeToName.put(typeName.toLowerCase(), clazz);
    }
602976
@Override
    public void setTypeMap(Map<String,Class<?>> map) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
17489
public static Class<?> resolveParameterType(MethodParameter methodParam, Class clazz) {
		Type genericType = getTargetType(methodParam);
		Preconditions.checkNotNull(clazz, "Class must not be null");
		Map<TypeVariable, Type> typeVariableMap = getTypeVariableMap(clazz);
		Type rawType = getRawType(genericType, typeVariableMap);
		Class result = (rawType instanceof Class ? (Class) rawType : methodParam.getParameterType());
		methodParam.setParameterType(result);
		methodParam.typeVariableMap = typeVariableMap;
		return result;
	}
1163206
public void registerVariantResolver(String clazz) {

		VariantResolver resolver = (VariantResolver) ClassLoaderResourceUtils.buildObjectInstance(clazz);
		registerVariantResolver(resolver);
	}
510130
private static Class registerTypeMapping(WSServer server, Class clazz) {
	java.lang.reflect.Method[] methods = clazz.getMethods();
	java.lang.reflect.Method method;
	Class[] params;
	for (int i = 0; i < methods.length; i++) {
	    method = methods[i];
	    if (method.getDeclaringClass() == clazz) {
		_registerTypeMapping(server, method.getReturnType());
		params = method.getParameterTypes();
		for (int y = 0; y < params.length; y++) {
		    _registerTypeMapping(server, params[y]);
		}
	    }
	}
	return clazz;
    }
1184738
private void tryRegister(String className, String fromStringMethodName) throws ClassNotFoundException {
        Class<?> cls = loadType(className);
        registerMethods(cls, "toString", fromStringMethodName);
    }
1254506
public <S extends T> TypeSerializationInfo<T> addTypeInfo( Class<S> clazz, String typeInfo ) {
        typeClassToInfo.put( clazz, typeInfo );
        return this;
    }
1146442
public void registerClass(Class<?> clazz) {
        registeredClasses.add(clazz);
        for (Field field : clazz.getFields()) {
            if (field.isAnnotationPresent(Opt.class)) {
                int mod = field.getModifiers();
                if (!Modifier.isPublic(mod)) { throw new IllegalStateException("@"+Opt.class.getName()+" on non-public field: " + field); }
                if (Modifier.isFinal(mod)) { throw new IllegalStateException("@"+Opt.class.getName()+" on final field: " + field); }
                if (Modifier.isAbstract(mod)) { throw new IllegalStateException("@"+Opt.class.getName()+" on abstract field: " + field); }

                // Add an Apache Commons CLI Option for this field.
                Opt opt = field.getAnnotation(Opt.class);

                String name = getName(opt, field);
                if (!names.add(name)) {
                    throw new RuntimeException("Multiple options have the same name: --" + name);
                }

                String shortName = null;
                if (createShortNames) {
                    shortName = getAndAddUniqueShortName(name);
                }
                
                Option apacheOpt = new Option(shortName, name, opt.hasArg(), opt.description());                    
                apacheOpt.setRequired(opt.required());
                options.addOption(apacheOpt);

                optionFieldMap.put(apacheOpt, field);

                // Check that only boolean has hasArg() == false.
                if (!field.getType().equals(Boolean.TYPE) && !opt.hasArg()) {
                    throw new RuntimeException("Only booleans can not have arguments.");
                }
            }
        }
    }
937923
public static Map<TypeVariable, Type> getTypeVariableMap(Class<?> clazz) {
		Map<TypeVariable, Type> typeVariableMap = typeVariableCache.get(clazz);

		if (typeVariableMap == null) {
			typeVariableMap = new HashMap<TypeVariable, Type>();

			// interfaces
			extractTypeVariablesFromGenericInterfaces(clazz.getGenericInterfaces(), typeVariableMap);

			try {
				// super class
				Class<?> type = clazz;
				while (type.getSuperclass() != null && !Object.class.equals(type.getSuperclass())) {
					Type genericType = type.getGenericSuperclass();
					if (genericType instanceof ParameterizedType) {
						ParameterizedType pt = (ParameterizedType) genericType;
						populateTypeMapFromParameterizedType(pt, typeVariableMap);
					}
					extractTypeVariablesFromGenericInterfaces(type.getSuperclass().getGenericInterfaces(), typeVariableMap);
					type = type.getSuperclass();
				}
			}
			catch (MalformedParameterizedTypeException ex) {
				// from getGenericSuperclass() - ignore and continue with member class check
			}

			try {
				// enclosing class
				Class<?> type = clazz;
				while (type.isMemberClass()) {
					Type genericType = type.getGenericSuperclass();
					if (genericType instanceof ParameterizedType) {
						ParameterizedType pt = (ParameterizedType) genericType;
						populateTypeMapFromParameterizedType(pt, typeVariableMap);
					}
					type = type.getEnclosingClass();
				}
			}
			catch (MalformedParameterizedTypeException ex) {
				// from getGenericSuperclass() - ignore and preserve previously accumulated type variables
			}

			typeVariableCache.put(clazz, typeVariableMap);
		}

		return typeVariableMap;
	}
756877
private FullTypeSignature getTypeSignature(Class<?> clazz) {
		StringBuilder sb = new StringBuilder();
		if (clazz.isArray()) {
			sb.append(clazz.getName());
		} else if (clazz.isPrimitive()) {
			sb.append(primitiveTypesMap.get(clazz).toString());
		} else {
			sb.append('L').append(clazz.getName()).append(';');
		}
		return TypeSignatureFactory.getTypeSignature(sb.toString(), false);

	}
854435
public DefinitionBinder bind(String beanName, Class<?> clazz) {
    return new DefinitionBinder(this).bind(beanName, clazz);
  }
86262
public <A> A register(final String name, final Type clazz, final A rs) {
        return register(true, name, clazz, rs);
    }
1166030
@Override
    @SuppressWarnings("unchecked")
    public void register(String extensionClassName, String blockName) throws MojoExecutionException {

        Class<? extends Processor> clazz;
        try {
            clazz = (Class<Processor>) Class.forName(extensionClassName);
        } catch (ClassCastException cce) {
            // Use RuntimeException to avoid catching, we only want the message in the Mojo
            throw new RuntimeException("'" + extensionClassName + "' is not a valid AsciidoctorJ processor class");
        } catch (ClassNotFoundException e) {
            throw new RuntimeException("'" + extensionClassName + "' not found in classpath");
        }

        // TODO: Replace with direct method calls again as soon as this project compiles against AsciidoctorJ 1.6.0
        if (DocinfoProcessor.class.isAssignableFrom(clazz)) {
            register(javaExtensionRegistry, "docinfoProcessor", clazz);
        } else if (Preprocessor.class.isAssignableFrom(clazz)) {
            register(javaExtensionRegistry, "preprocessor", clazz);
        } else if (Postprocessor.class.isAssignableFrom(clazz)) {
            register(javaExtensionRegistry, "postprocessor", clazz);
        } else if (Treeprocessor.class.isAssignableFrom(clazz)) {
            register(javaExtensionRegistry, "treeprocessor", clazz);
        } else if (BlockProcessor.class.isAssignableFrom(clazz)) {
            if (blockName == null) {
                register(javaExtensionRegistry, "block", clazz);
            } else {
                register(javaExtensionRegistry, "block", blockName, clazz);
            }
        } else if (IncludeProcessor.class.isAssignableFrom(clazz)) {
            register(javaExtensionRegistry, "includeProcessor", clazz);
        } else if (BlockMacroProcessor.class.isAssignableFrom(clazz)) {
            if (blockName == null) {
                register(javaExtensionRegistry, "blockMacro", clazz);
            } else {
                register(javaExtensionRegistry, "blockMacro", blockName, clazz);
            }
        } else if (InlineMacroProcessor.class.isAssignableFrom(clazz)) {
            if (blockName == null) {
                register(javaExtensionRegistry, "inlineMacro", clazz);
            } else {
                register(javaExtensionRegistry, "inlineMacro", blockName, clazz);
            }
        }
    }
266460
public static function addType(string $name, string $className) : void
    {
        if (isset(self::$typesMap[$name])) {
            throw MappingException::typeExists($name);
        }

        self::$typesMap[$name] = $className;
    }
1198056
public static void register(Class<? extends View> clazz) {
        if (clazz != null) {
            register(clazz.getSimpleName(), clazz.getName());
        }
    }
306402
public static String getTypeName(Class<?> clazz) {
		Type typeAnnotation = clazz.getAnnotation(Type.class);
		return typeAnnotation != null ? typeAnnotation.value() : null;
	}
1199284
private void setTypeMappers(TypeMapper[] typeMappers) throws SQLException {

        if (typeMappers.length > 0) {
            Map<String, Class<?>> mappers = _connection.getTypeMap();
            for (TypeMapper t : typeMappers) {
                mappers.put(t.UDTName(), t.mapperClass());
            }
            _connection.setTypeMap(mappers);
        }
    }