blob: c87bd27f5089807b56d437a71b2398bc467e94ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package org.zwobble.couscous.values;
import static java.util.Arrays.asList;
import static org.zwobble.couscous.values.TypeReference.typeRef;
import lombok.Value;
import lombok.val;
@Value
public class IntegerValue implements InterpreterValue {
public static final TypeReference REF = typeRef("java.lang.Integer");
public static final ConcreteType<?> TYPE = ConcreteType.<IntegerValue>builder(REF)
.staticMethod("parseInt", asList(StringValue.REF),
(environment, arguments) -> {
val value = (StringValue)arguments.get(0);
return new IntegerValue(Integer.parseInt(value.getValue()));
})
.build();
int value;
@Override
public ConcreteType<?> getType() {
return TYPE;
}
}
|