All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.basking2.sdsai.itrex.functions.VersionFunction Maven / Gradle / Ivy

There is a newer version: 1.1.23
Show newest version
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