https://github.com/kryptonbutterfly/xmlconfig4j
A Simple to use Library for Object de-/serialization to xml-Format
https://github.com/kryptonbutterfly/xmlconfig4j
config java xml xml-serialization
Last synced: 10 months ago
JSON representation
A Simple to use Library for Object de-/serialization to xml-Format
- Host: GitHub
- URL: https://github.com/kryptonbutterfly/xmlconfig4j
- Owner: kryptonbutterfly
- License: apache-2.0
- Created: 2019-05-22T13:43:25.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-02-17T16:03:54.000Z (about 2 years ago)
- Last Synced: 2025-02-21T09:20:25.018Z (about 1 year ago)
- Topics: config, java, xml, xml-serialization
- Language: Java
- Homepage:
- Size: 178 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# xmlConfig4J [](https://github.com/kryptonbutterfly/xmlConfig4J/actions/workflows/maven-publish.yml)
A Simple to use Library for Object de-/serialization to xml-Format
## Getting the latest release
```xml
github
https://maven.pkg.github.com/kryptonbutterfly/maven-repo
```
```xml
kryptonbutterfly
xml_config_4j
3.2.0
```
## Download
java version
library version
Download
18+
3.2.0
xmlConfig4J.jar
18+
3.1.0
xmlConfig4J.jar
18+
2.2.0
xmlConfig4J.jar
18+
2.1.0
xmlConfig4J.jar
18+
2.0.7
xmlConfig4J.jar
8+
2.0.4
xmlConfig4J.jar
## Dependencies
#### version > 2.1.0
* use maven
#### version 2.1.0
* [**ReflectionUtils.jar**](https://github.com/kryptonbutterfly/ReflectionUtils/releases/download/v1.0.0/ReflectionUtils.jar)
#### version 2.0.5 - 2.0.7
–
#### version < 2.0.5
* [apache / **commons-lang**](https://commons.apache.org/proper/commons-lang/download_lang.cgi)
* [apache / **logging-log4j2**](https://logging.apache.org/log4j/2.x/download.html)
## License
This project is licensed under Apache License 2.0 - see the [LICENSE](https://github.com/kryptonbutterfly/xmlConfig4J/blob/master/LICENSE) file for details
## Contributing
Please do contribute!
Any help with this project is greatly appreciated.
## Example
The class TinyExample:
```java
public class TinyExample extends FileConfig
{
public TinyExample()
{
super(new File("./config.xml"));
}
@Value("List of favorite foods.")
public ArrayList favoriteFoods = genFavFoods();
@Value
public int someNumber = 1337;
@Value
public CustomClass cc = new CustomClass();
@Value
public HashMap map = new HashMap<>();
{
map.put("A", "a");
map.put("B", null);
map.put(null, "A");
}
@Value
public String[][] array = new String[][] {{"Banana", null}, null, {}, {"Apple", "Orange"}};
@Value
public HashSet set = new HashSet<>();
{
set.add("A");
set.add("B");
set.add("C");
set.add(null);
}
private ArrayList genFavFoods()
{
ArrayList list = new ArrayList<>();
list.add("Banana");
list.add("Apple");
list.add(null);
list.add("Cheese");
return list;
}
public static void main(String[] args) throws IOException
{
TinyExample config = new TinyExample();
if(config.exists())
{
config.load();
System.out.println("List:");
config.favoriteFoods.stream().map(s -> "\t" + s).forEach(System.out::println);
System.out.printf("%nsomeNumber:%n\t%s%n", config.someNumber);
System.out.printf("%nPi:%n\t%s%n", config.cc.pi);
System.out.printf("%nMap:%n");
config.map.entrySet().stream().map(s -> "\t" + s).forEach(System.out::println);
System.out.printf("%nSet:%n");
config.set.stream().map(s -> "\t" + s).forEach(System.out::println);
System.out.printf("%nArray:%n%s%n", Arrays.deepToString(config.array));
}
config.save();
}
public static class CustomClass
{
@Value
public double pi = Math.PI;
}
}
```
generates the config File ./config.xml :
```xml
```