net.intelie.pipes.ValueFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pipes-api Show documentation
Show all versions of pipes-api Show documentation
Intelie Pipes' API classes and interfaces
package net.intelie.pipes;
import net.intelie.pipes.types.Type;
import net.intelie.pipes.util.LiteralRepresentation;
public class ValueFunction implements Function {
private static final long serialVersionUID = 1L;
private final String name;
private final Type type;
private final Object value;
public ValueFunction(String name, Object value) {
this(name, Type.infer(value), value);
}
public ValueFunction(String name, Type type, Object value) {
this.name = name;
this.type = type;
this.value = value;
}
@Override
public Object declare(ArgQueue queue) throws PipeException {
return new Literal<>(type, value);
}
@Override
public String description() {
return "value " + LiteralRepresentation.toString(type, value);
}
@Override
public String name() {
return name;
}
@Override
public HelpData help() {
return new HelpData(
null,
name,
name + (!name.startsWith("@") ? "()" : ""),
"value " + LiteralRepresentation.toString(type, value),
null,
null,
null,
null
);
}
}