Method used during deserialization to find handler for given
non-generic type.
161094
public ValueReader findReader(Class<?> raw)
    {
        ClassKey k = (_key == null) ? new ClassKey(raw, _features) : _key.with(raw, _features);
        ValueReader vr = _knownReaders.get(k);
        if (vr != null) {
            return vr;
        }
        vr = createReader(null, raw, raw);
        // 15-Jun-2016, tatu: Let's limit maximum number of readers to prevent
        //   unbounded memory retention (at least wrt readers)
        if (_knownReaders.size() >= MAX_CACHED_READERS) {
            _knownReaders.clear();
        }
        _knownReaders.putIfAbsent(new ClassKey(raw, _features), vr);
        return vr;
    }
174246
public final int findSerializationType(Class<?> raw)
    {
        if (raw == _prevClass) {
            return _prevType;
        }
        if (raw == String.class) {
            return SER_STRING;
        }
        ClassKey k = (_key == null) ? new ClassKey(raw, _features) : _key.with(raw, _features);
        int type;

        Integer I = _knownSerTypes.get(k);

        if (I == null) {
            type = _findPOJOSerializationType(raw);
            _knownSerTypes.put(new ClassKey(raw, _features), Integer.valueOf(type));
        } else {
            type = I.intValue();
        }
        _prevType = type;
        _prevClass = raw;
        return type;
    }
1356346
public Optional<MapperInstance> getDeserializer( JType type ) {
        return Optional.fromNullable( deserializers.get( type.getQualifiedSourceName() ) );
    }
860124
def deserialize(klass, data):
    
    handler = DESERIALIZE_REGISTRY.get(klass)
    if handler:
        return handler(data)
    raise TypeError("There is no deserializer registered to handle "
                    "instances of '{}'".format(klass.__name__))
896513
private Method findHandlerMethod(Object target, Class<? extends IEvents> eventsClass,
            String eventName, Object[] params) {
        // Use cached method if available. Note: no further type checking is done if the
        // method has been cached. It will be checked by JRE when the method is invoked.
        Method cachedMethod = getCachedMethod(target, eventName);
        if (cachedMethod != null) {
            return cachedMethod;
        }

        // Check the event and params against the eventsClass interface object.
        Method nameMatch = null;
        Method signatureMatch = null;
        for (Method method : eventsClass.getMethods()) {
            // Match method name and event name
            if (method.getName().equals(eventName)) {
                nameMatch = method;

                // Check number of parameters
                Class<?>[] types = method.getParameterTypes();
                if (types.length != params.length)
                    continue;

                // Check parameter types
                int i = 0;
                boolean foundMatchedMethod = true;
                for (Class<?> type : types) {
                    Object param = params[i++];
                    if (!isInstanceWithAutoboxing(type, param)) {
                        foundMatchedMethod = false;
                        break;
                    }
                }

                if (foundMatchedMethod) {
                    signatureMatch = method;
                    break;
                }
            }
        }

        // Error
        if (nameMatch == null) {
            throw new RuntimeException(String.format("The interface contains no method %s", eventName));
        } else if (signatureMatch == null ){
            throw new RuntimeException(String.format("The interface contains a method %s but "
                    + "parameters don't match", eventName));
        }

        // Cache the method for the target, even if it doesn't implement the interface. This is
        // to avoid always verifying the event.
        addCachedMethod(target, eventName, signatureMatch);

        return signatureMatch;
    }
651238
public final <T> void registerType(Class<T> runtimeClass, TypeHandler<T> handler) {
        if (started) {
            // Can't add any more metrics anyway; harmless
            return;
        }
        typeHandlers.put(runtimeClass, handler);
    }
715900
def get_handler(self, request):
        
        try:
            f = self._json_rpc_methods[request.method]

        except (AttributeError, KeyError):  # pragma no coverage
            raise RPCMethodError("Received invalid method '{}'".format(request.method))

        return f
1204127
@SuppressWarnings("unchecked")
    public <T> Deserializer<T> getDeserializer(Class<T> type, String mediaType) throws SerializationException {
        checkNotNull(type, "Type (Class<T>) cannot be null.");
        checkNotNull(mediaType, "Media-Type cannot be null.");

        final String typeName = getClassName(type);
        final Key key = new Key(typeName, mediaType);

        logger.log(Level.FINE, "Querying for Deserializer of type '" + typeName + "' and " + "media-type '" + mediaType
                + "'.");

        ArrayList<DeserializerHolder> holders = deserializers.get(typeName);
        if (holders != null) {
            for (DeserializerHolder holder : holders) {
                if (holder.key.matches(key)) {
                    logger.log(Level.FINE, "Deserializer for type '" + holder.deserializer.handledType() + "' and " +
                            "media-type '" + Arrays.toString(holder.deserializer.mediaType()) + "' matched: " +
                            holder.deserializer.getClass().getName());
                    return (Deserializer<T>) holder.deserializer;
                }
            }
        }

        logger.log(Level.WARNING, "There is no Deserializer registered for " + type.getName() +
                " and media-type " + mediaType + ". If you're relying on auto-generated deserializers," +
                " please make sure you imported the correct GWT Module.");

        return null;
    }
967224
public static Method findMethod(Class<?> type, String name,
			Class<?>... parameterTypes) {
		while (type != null) {
			try {
				return type.getDeclaredMethod(name, parameterTypes);
			} catch (Exception e) {
			}
			type = type.getSuperclass();
		}
		return null;
	}
880373
private static <T extends Callback> T getCallbackByType(Iterable<Callback> callbacks, Class<T> callbackType) {
		T foundCallback = null;
		Iterator<Callback> callbackIterator = callbacks.iterator();
		while (foundCallback == null && callbackIterator.hasNext()) {
			Callback callback = callbackIterator.next();
			// Remove callback wrappers
			while ((callback instanceof Delegating) && (!callbackType.isInstance(callback))) {
				callback = ((Delegating<Callback>) callback).getDelegate();
			}
			if (callbackType.isInstance(callback)) {
				// Callback found
				foundCallback = callbackType.cast(callback);
			} else if (callback instanceof CompositeCallback) {
				// Visit the composite callback
				foundCallback = getCallbackByType(((CompositeCallback) callback).callbacks(), callbackType);
			}
		}
		return foundCallback;
	}
1184822
private static Class<?> extractGeneric(Type type) {
        if (type instanceof ParameterizedType) {
            Type[] genericTypes = ((ParameterizedType) type).getActualTypeArguments();
            if (genericTypes.length > 0 && genericTypes[0] instanceof Class) {
                return (Class<?>) genericTypes[0];
            }
        }
        return Object.class;
    }
611370
def is_handler(cls, name, value):
        """"""
        signal_name = False
        config = None
        if callable(value) and hasattr(value, SPEC_CONTAINER_MEMBER_NAME):
                spec = getattr(value, SPEC_CONTAINER_MEMBER_NAME)
                if spec['kind'] == 'handler':
                    signal_name = spec['name']
                    config = spec['config']
        return signal_name, config
1129900
@Override
    public ReadStream<Buffer> handler(Handler<Buffer> handler) {
        if (handler == null) {
            throw new IllegalArgumentException("handler");
        }
        this.dataHandler = handler;
        doRead();
        return this;
    }
1219523
public JsonRequestHandler getRequestHandler(RequestType pType) {
        JsonRequestHandler handler = requestHandlerMap.get(pType);
        if (handler == null) {
            throw new UnsupportedOperationException("Unsupported operation '" + pType + "'");
        }
        return handler;
    }
360818
private static Class<?> getSerializerType(Object instance) {
    Type type = instance.getClass().getGenericInterfaces()[0];
    if (type instanceof ParameterizedType) {
      Class<?> cls = null;
      Type clsType = ((ParameterizedType) type).getActualTypeArguments()[0];

      if (clsType instanceof GenericArrayType) {
        // Workaround for Java 6 (JDK bug 7151486)
        cls = Array.newInstance((Class) ((GenericArrayType) clsType).getGenericComponentType(), 0).getClass();
      } else {
        cls = (Class<?>) clsType;
      }

      if (Object.class.equals(cls)) {
        throw new RuntimeException("The serializer type can't be object");
      }
      return cls;
    } else {
      throw new RuntimeException(String
          .format("The serializer class %s is not generic or has an unknown type", instance.getClass().getName()));
    }
  }
1172267
protected <T> Converter<T> find(Class<T> type) throws ConversionException {
        //noinspection unchecked
        Converter<T> converter = (Converter<T>) storage.get(type);
        if (converter == null) {
            if (type.isEnum()) {
                //noinspection unchecked
                return new EnumConverter((Class<? extends Enum>) type);
            }
            if (type.isArray()) {
                Class<?> componentType = type.getComponentType();
                Converter childConverter = find(componentType);
                //noinspection unchecked
                return new ArrayConverter(childConverter, componentType, stringSplitter);
            }
            throw new ConversionException(String.format("Could not find converter for type <%s>", type));
        }
        return converter;
    }
234198
def extern_get_type_for(self, context_handle, val):
    """"""
    c = self._ffi.from_handle(context_handle)
    obj = self._ffi.from_handle(val[0])
    type_id = c.to_id(type(obj))
    return TypeId(type_id)