blob: 15adcdb3438c8f4ff575ff22438af489d56dd6c7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.yql;
import com.google.common.base.Preconditions;
class JavaTypeChecker extends OperatorTypeChecker {
private final Class<?> type;
public JavaTypeChecker(Operator parent, int idx, Class<?> type) {
super(parent, idx);
this.type = type;
}
@Override
public void check(Object argument) {
Preconditions.checkNotNull(argument, "Argument %s of %s must not be null", idx, parent);
Preconditions.checkArgument(type.isInstance(argument), "Argument %s of %s must be %s (is: %s).", idx, parent, type.getName(), argument.getClass().getName());
}
}
|