class ObjectTypeRetriever implements Function<Object, Class<?>> {

    @Override
    public Class<?> apply(@Nullable Object object) {
        if (object == null) {
            return NullType.class;
        } else if (object instanceof Class) {
            return (Class) object;
        } else {
            return object.getClass();
        }
    }

}