32 lines
659 B
Java
32 lines
659 B
Java
package dev.peerat.parser.java.operation;
|
|
|
|
import java.util.function.Function;
|
|
|
|
import dev.peerat.parser.java.JavaElement;
|
|
import dev.peerat.parser.java.Operation;
|
|
import dev.peerat.parser.java.Value;
|
|
|
|
public class ThrowOperation extends Operation{
|
|
|
|
private Value value;
|
|
|
|
public ThrowOperation(Value value){
|
|
this.value = value;
|
|
}
|
|
|
|
public Value getValue(){
|
|
return this.value;
|
|
}
|
|
|
|
@Override
|
|
public void build(Builder builder) throws Exception {
|
|
builder.append(" throw ");
|
|
value.build(builder);
|
|
}
|
|
|
|
@Override
|
|
public <E extends JavaElement> E find(Function<JavaElement, Boolean> finder) {
|
|
return finder.apply(value) ? (E)value : null;
|
|
}
|
|
|
|
}
|