HMFF - A Hierarchical Mapping File Format

Related tags

Utility HMFF
Overview

HMFF - A Hierarchical Mapping File Format

This library provides a recursive key-value interpretation for your configuration files, with comment support. The goal of HMFF is to provide a configuration file with the end user in mind. End users need comments and may not be familiar with concepts like encapsulation, escaping, data types or complex data structures. HMFF keeps it simple while staying flexible. Any text based input will have a valid HMFF interpretation.

Include with Maven


   
    
    
        
     
      jitpack.io
     
        
     
      https://jitpack.io
     
    
    

   


   
    
    
        
     
      com.github.justisr
     
        
     
      HMFF
     
        
     
      master-SNAPSHOT
     
    
    

   

Using master-SNAPSHOT in place of a version will always provide you the latest build for the master branch. Alternatively, use the short form of your target commit hash.

You can then shade HMFF into your project using a shade configuration like so:


   
    
    
     org.apache.maven.plugins
    
    
    
     maven-shade-plugin
    
    
    
     3.2.1
    
    
    
        
     
            
      
                
       
        com.github.justisr:HMFF
       
            
      
        
     
        
     
            
      
                
       
        com.gmail.justisroot.hmff
       
                
       
        yourpackage.hmff
       
            
      
        
     
    
    
    
    
        
     
            
      
       package
      
            
      
                
       
        shade
       
            
      
        
     
    
    

   

Ensure that you are relocating the shaded HMFF library within your own project's packages to avoid potential version conflicts with other projects.

JavaDocs

Here you can find the latest version of HMFF's public JavaDocs.

Implementations

HMFF serves as a file wrapper, so creating a HMFF configuration is as simple as passing a file into the HMFF constructor.

HMFF hmff = new HMFF(file);

If the file already contains your configuration contents, you can imediately read from it. If you're not sure if the file contains your configuration at this point, and you'd like to populate the missing values, you have a couple options.

Firstly, you can use an inputstream, perhaps obtained from an internal resource within your jar, to write out the defaults of the configuration if it is empty. Passing false as the overwrite param ensures that if the file has existing contents, an overwrite will not occur.

hmff.save(inputStream, false);

Secondly, if you have an existing HMFF instance and would like to copy the contents over to another (including comments), you may do the following:

hmff.copyTo(targetHMFF);

Alternatively, or in addition, you can create individual default vaules if the specified path doesn't yet exist:

hmff.getOrSetString("default", "path", "to", "value");
hmff.getOrSetBoolean(false, "path", "to", "boolean");
hmff.getOrSetDouble(3.14, "path", "to", "pi");
hmff.getOrSetStringArray(new String[]{"array", "contents"}, "path", "to", "pi");

The return values of each of these lines obviously being either the default value you passed, or the existing value at that location. If the path did not exist, it will be created with the default value you provided, thus allowing you to obtain all of the configuration values while also generating your defaults in the same stroke.

For situations where obtaining the default value is intensive, the default can also be provided within a Callable, which will only run if the value does not exist and the default is needed:

hmff.getOrSetStringArray(() -> calculateArrayContents(), "path", "to", "pi");

Arrays will be written to file in the format [array, contents, etc] but if you attempt to retrieve an array from a value that is not in this format, it will be interpretted using spaces as a delimiter.

key: array contents etc

Given the above contents for instance, hmff.getStringArray("key") would return the array [array, contents, etc].

Contributing

Public classes and methods should ensure JavaDoc validity and maintain backwards compatibility at all times. For major changes, please create an issue to propose your idea.

Pull requests should always be made to the develop branch and should contain unit tests for any new code that is not already covered by existing tests.

License

Copyright (C) 2020 Justis Root [email protected] (MIT License)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...

A simple program that is realized by entering data, storing it in memory (in a file) and reading from a file to printing that data.

A simple program that is realized by entering data, storing it in memory (in a file) and reading from a file to printing that data.

Pet project A simple program that is realized by entering data, storing it in memory (in a file) and reading from a file to printing that data. It can

Apr 28, 2022

Classpy is a GUI tool for investigating Java class file, Lua binary chunk, Wasm binary code, and other binary file formats.

Classpy is a GUI tool for investigating Java class file, Lua binary chunk, Wasm binary code, and other binary file formats.

Classpy Classpy is a GUI tool for investigating Java class file, Lua binary chunk, Wasm binary code, and other binary file formats. Inspiration This t

Dec 17, 2022

dOOv (Domain Object Oriented Validation) a fluent API for type-safe bean validation and mapping

dOOv (Domain Object Oriented Validation) dOOv is a fluent API for typesafe domain model validation and mapping. It uses annotations, code generation a

Nov 20, 2022

Intelligent object mapping

ModelMapper ModelMapper is an intelligent object mapping library that automatically maps objects to each other. It uses a convention based approach wh

Dec 28, 2022

Simpler, better and faster Java bean mapping framework

Simpler, better and faster Java bean mapping framework

Orika ! NEW We are pleased to announce the release of Orika 1.5.4 ! This version is available on Maven central repository What? Orika is a Java Bean m

Jan 6, 2023

A declarative mapping library to simplify testable object mappings.

ReMap - A declarative object mapper Table of Contents Long story short About ReMap Great News Mapping operations Validation Features Limitations The m

Dec 27, 2022

Selma Java bean mapping that compiles

Selma Java bean mapping that compiles

Selma Java bean mapping at compile time ! What is Selma ? S3lm4 say Selma, stands for Stupid Simple Statically Linked Mapper. In fact it is on one sid

Nov 2, 2022

Governator is a library of extensions and utilities that enhance Google Guice to provide: classpath scanning and automatic binding, lifecycle management, configuration to field mapping, field validation and parallelized object warmup.

Governator DESCRIPTION Governator is a library of extensions and utilities that enhance Google Guice to provide injector lifecycle and well as support

Dec 28, 2022

DAO oriented database mapping framework for Java 8+

Doma Doma 2 is a database access framework for Java 8+. Doma has various strengths: Verifies and generates source code at compile time using annotatio

Dec 28, 2022

Fast and Easy mapping from database and csv to POJO. A java micro ORM, lightweight alternative to iBatis and Hibernate. Fast Csv Parser and Csv Mapper

Simple Flat Mapper Release Notes Getting Started Docs Building it The build is using Maven. git clone https://github.com/arnaudroger/SimpleFlatMapper.

Dec 17, 2022

Mars - Object Relational Mapping Framework for MongoDB (MongoDB ORM)

Mars   -  Object Relational Mapping  Framework for MongoDB  (MongoDB ORM)

Mars Object Relational Mapping Framework for MongoDB 致自己 造自己的轮子,让别人去说 ; What is Mars Mars is a unified driver platform product developed by Shanghai J

Nov 17, 2022

HasorDB is a Full-featured database access tool, Providing object mapping,Richer type handling than Mybatis, Dynamic SQL

HasorDB is a Full-featured database access tool, Providing object mapping,Richer type handling than Mybatis, Dynamic SQL

HasorDB is a Full-featured database access tool, Providing object mapping,Richer type handling than Mybatis, Dynamic SQL, stored procedures, more dialect 20+, nested transactions, multiple data sources, conditional constructors, INSERT strategies, multiple statements/multiple results. And compatible with Spring and MyBatis usage.

Oct 27, 2022

An object mapping jetbrains plugin, it will automatically generate the get/set code between the two objects.

BeanMappingKey 简体中文 | English 一键生成两个实体类之间的字段映射代码,用于代替 BeanUtil 与 MapStruct 等工具。 使用指南 在 Java 开发的过程中,经常会使用众多包装型的对象如:BO、VO、DTO,它们之间往往只有两三个字段的差异, 而对它们进行相互

Dec 14, 2022

dOOv (Domain Object Oriented Validation) a fluent API for type-safe bean validation and mapping

dOOv (Domain Object Oriented Validation) dOOv is a fluent API for typesafe domain model validation and mapping. It uses annotations, code generation a

Nov 20, 2022

Reladomo is an enterprise grade object-relational mapping framework for Java.

Reladomo What is it? Reladomo is an object-relational mapping (ORM) framework for Java with the following enterprise features: Strongly typed compile-

Nov 2, 2022

Hibernate's core Object/Relational Mapping functionality

Hibernate ORM is a library providing Object/Relational Mapping (ORM) support to applications, libraries, and frameworks. It also provides an implement

Jan 9, 2023

JFXNodeMapper - a simple library that focuses on mapping data from common data represntation formats to JavaFx Nodes

JFXNodeMapper - a simple library that focuses on mapping data from common data represntation formats to JavaFx Nodes. Our main focus is to build a library that,

Oct 15, 2021

Applied Spring Data JPA technologies including mapping, connecting real DB, Hibernate, Queries, Paging & Sorting, various Relationships, Transactions

Applied Spring Data JPA technologies including mapping, connecting real DB, Hibernate, Queries, Paging & Sorting, various Relationships, Transactions

University Management In this project, I practiced & applied Spring Data JPA technologies including mapping, connecting real DB, Hibernate, Queries, P

Sep 5, 2022
Owner
Justis R
Justis R
Java lib for monitoring directories or individual files via java.nio.file.WatchService

ch.vorburger.fswatch Java lib for monitoring directories or individual files based on the java.nio.file.WatchService. Usage Get it from Maven Central

Michael Vorburger ⛑️ 21 Jan 7, 2022
Dfinder - a local file browser made with Java

Dfinder is a local file browser, which searches through files (according to the user's choice) and then generates a txt file containing the search results.

saad labriji 7 Oct 8, 2022
A utility for guessing the CCSID of files (based on file contents)

CcsidGuesser A utility for guessing the CCSID of files (based on file contents). It can also fix CCSID tags and/or convert files to UTF-8! Usage Usage

Jesse Gorzinski 4 Feb 21, 2022
Hierarchical Temporal Memory implementation in Java - an official Community-Driven Java port of the Numenta Platform for Intelligent Computing (NuPIC).

htm.java Official Java™ version of... Hierarchical Temporal Memory (HTM) Community-supported & ported from the Numenta Platform for Intelligent Comput

Numenta 301 Dec 1, 2022
A simple hierarchical state machine compiler that generates C.

Makina is a hierarchical state machine source-to-source translator. It takes state machine descriptions as input and produces C language implementations of those state machines.

Colin Holzman 111 Oct 17, 2022
SLUGGER: Lossless Hierarchical Summarization of Massive Graphs

SLUGGER: Lossless Hierarchical Summarization of Massive Graphs Source code for the paper SLUGGER: Lossless Hierarchical Summarization of Massive Graph

null 2 Dec 14, 2021
Generates a Proguard mapping file for use in obfuscating your Java projects.

Reaper Generates a Proguard mapping file for use in obfuscating your Java projects. Features Automatically checks for duplicate names. Interactive, in

Nox 12 Dec 29, 2022
Generate flame graph in HTML format from jfr(Java Flight Recorder) file

jfr-flamegraph-generator Generate Flame Graph from .jfr file. Get Started Executable jar and executable binary for Linux, Windows and macOS are provid

Lawrence Ching 3 Sep 22, 2022
IntelliJ Platform plugin that shows the file name of the currently open file in the status bar.

IntelliJ Platform plugin that shows the file name of the currently open file in the status bar. Clicking shows a list of recent files.

Christoffer Hammarström 4 May 9, 2022
A GUI-based file manager based on a Java file management and I/O framework using object-oriented programming ideas.

FileManager A GUI-based file manager based on a Java file management and I/O framework using object-oriented programming ideas. Enables folder creatio

Zongyu Wu 4 Feb 7, 2022