io.sbp.api.Sbp Maven / Gradle / Ivy
/**
* Copyright (c) KMG. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
package io.sbp.api;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.javaprop.JavaPropsFactory;
import io.sbp.config.SbpVersion;
import java.io.IOException;
public class Sbp {
final private static String VERSION_FILE = "sbp-version.properties";
public static SbpVersion getVersion() throws IOException {
final ObjectMapper mapper = new ObjectMapper(new JavaPropsFactory())
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return mapper.readValue(Sbp.class.getClassLoader().getResourceAsStream(VERSION_FILE),
SbpVersion.class);
}
}