Search in sources :

Example 26 with PropertiesMapper

use of com.tvd12.properties.file.mapping.PropertiesMapper 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);
}
Also used : BaseFileReader(com.tvd12.properties.file.reader.BaseFileReader) PropertiesMapper(com.tvd12.properties.file.mapping.PropertiesMapper) Properties(java.util.Properties) MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader)

Aggregations

Properties (java.util.Properties)26 PropertiesMapper (com.tvd12.properties.file.mapping.PropertiesMapper)25 Test (org.testng.annotations.Test)24 SimpleDateFormat (java.text.SimpleDateFormat)12 Date (java.util.Date)12 BaseFileReader (com.tvd12.properties.file.reader.BaseFileReader)3 Map (java.util.Map)3 Property (com.tvd12.properties.file.annotation.Property)2 PropertyAnnotation (com.tvd12.properties.file.annotation.PropertyAnnotation)2 Dates (com.tvd12.properties.file.io.Dates)2 MappingLevel (com.tvd12.properties.file.mapping.MappingLevel)2 PropertiesUtil (com.tvd12.properties.file.util.PropertiesUtil)2 Data (lombok.Data)2 Getter (lombok.Getter)2 Setter (lombok.Setter)2 Assert.assertEquals (org.testng.Assert.assertEquals)2 Assert.assertNotNull (org.testng.Assert.assertNotNull)2 MultiFileReader (com.tvd12.properties.file.reader.MultiFileReader)1 PropertiesUtil.toProperties (com.tvd12.properties.file.util.PropertiesUtil.toProperties)1 HashMap (java.util.HashMap)1