net.intelie.pipes.RawFunction 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 RawFunction implements Function {
private static final long serialVersionUID = 1L;
private final String name;
private final Object value;
private final HelpData help;
public RawFunction(String name, Object value) {
this(name, value,
new HelpData(null, name, name + (!name.startsWith("@") ? "()" : ""), makeDescription(value), null, null, null, null));
}
private static String makeDescription(Object value) {
return "raw " + LiteralRepresentation.toString(Type.infer(value), value);
}
public RawFunction(String name, Object value, HelpData help) {
this.name = name;
this.value = value;
this.help = help;
}
@Override
public Object declare(ArgQueue queue) throws PipeException {
return value;
}
@Override
public String description() {
return makeDescription(value);
}
@Override
public String name() {
return name;
}
@Override
public HelpData help() {
return help;
}
}