com.github.basking2.sdsai.itrex.functions.VersionFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdsai-itrex Show documentation
Show all versions of sdsai-itrex Show documentation
An S-Expression inspiried library focused on iterators.
package com.github.basking2.sdsai.itrex.functions;
import com.github.basking2.sdsai.itrex.EvaluationContext;
import com.github.basking2.sdsai.itrex.SExprRuntimeException;
import java.io.IOException;
import java.util.Iterator;
import java.util.Properties;
/**
* Igore all arguments and return the version of this package.
*/
public class VersionFunction implements FunctionInterface {
@Override
public String apply(Iterator> iterator, EvaluationContext evaluationContext) {
Properties p = new Properties();
try {
p.load(
getClass().getResourceAsStream(getClass().getSimpleName() + ".properties")
);
return p.getProperty("version", "not available");
} catch (IOException e) {
throw new SExprRuntimeException("Loading version", e);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy