use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.
the class PropertiesFileReaderTest method getInputStreamByAbsolutePathTest.
@Test
public void getInputStreamByAbsolutePathTest() {
Method method = MethodBuilder.create().clazz(InputStreamUtil.class).method("getInputStreamByAbsolutePath").argument(File.class).build();
ReflectMethodUtil.invokeMethod(method, new BaseFileReader(), new File(getClass().getResource("/invalid.properties").getFile()));
ReflectMethodUtil.invokeMethod(method, new BaseFileReader(), new ExFile("abc"));
}
use of com.tvd12.properties.file.reader.BaseFileReader in project ezyhttp by youngmonkeys.
the class MessageReader method read.
public Map<String, Properties> read(String folderPath) {
List<MessagesFile> files = getMessagesFiles(folderPath);
Map<String, Properties> answer = new HashMap<>();
FileReader fileReader = new BaseFileReader();
for (MessagesFile file : files) {
Properties properties = file.resourceFile.isInJar() ? fileReader.read(file.resourceFile.getRelativePath()) : fileReader.read(new File(file.resourceFile.getFullPath()));
answer.computeIfAbsent(file.language, k -> new Properties()).putAll(properties);
answer.computeIfAbsent(file.language.toLowerCase(), k -> new Properties()).putAll(properties);
}
return answer;
}
use of com.tvd12.properties.file.reader.BaseFileReader in project ezyfox-examples by tvd12.
the class PropertiesFile method main.
public static void main(String[] args) {
Properties properties = new MultiFileReader().read("application.properties");
System.out.println("properties: " + properties);
Properties propertiesAlpha = new MultiFileReader("alpha").read("application.properties");
System.out.println("properties alpha: " + propertiesAlpha);
ApplicationConfig applicationConfig = new PropertiesMapper().reader(new MultiFileReader("alpha")).file("application.properties").map(ApplicationConfig.class);
System.out.println("applicationConfig alpha: " + applicationConfig);
Properties yamlProperties = new BaseFileReader().read("application.yaml");
System.out.println("yaml properties: " + yamlProperties);
Properties yamlPropertiesAlpha = new MultiFileReader("alpha").read("application.yaml");
System.out.println("yaml properties alpha: " + yamlPropertiesAlpha);
ApplicationConfig applicationConfigYaml = new PropertiesMapper().reader(new MultiFileReader("alpha")).file("application.yaml").map(ApplicationConfig.class);
System.out.println("applicationConfigYaml alpha: " + applicationConfigYaml);
}
Aggregations