Skip to content
/ VMF Public
forked from miho/VMF

VMF is a Lightweight Modeling Framework for the Java Platform (works on JDK 8-13)

License

Notifications You must be signed in to change notification settings

BioFluidix/VMF

 
 

Repository files navigation

VMF

Download Javadocs Javadocs VMF CI Join the chat at https://gitter.im/VMF_/Lobby

VMF is a lightweight modeling framework. It conveniently translates annotated Java interfaces into powerful implementations. It writes all the inevitable but boring boilerplate code for you and provides a modern and stable API. It is designed to work with the newest versions of Java as soon as they are released. It works well with Java 8-13. It generates/supports:

  • getters and setters
  • default values
  • containment
  • builder API
  • equals() and hashCode()
  • deep and shallow cloning
  • change notification
  • undo/redo
  • object graph traversal API via iterators and streams
  • immutable types and read-only wrappers
  • delegation
  • annotations
  • reflection
  • ...

A VMF model consists of annotated Java interfaces. We could call this "wannabe" code. We just specify the interface and its properties and get a rich implementation that implements the property setters and getters, builders and much more. Even for a simple model VMF generated a lot of useful API:

Using VMF

Checkout the tutorial projects: https://github.com/miho/VMF-Tutorials

VMF comes with excellent Gradle support. Just add the plugin like so (get the latest version here):

plugins {
  id "eu.mihosoft.vmf" version "0.2.6.1" // use latest version
}

Now just add the model definitions to the VMF source folder, e.g., src/main/vmf/. The package name must end with .vmfmodel, for example:

package eu.mihosoft.vmf.tutorial.vmfmodel;

import eu.mihosoft.vmf.core.Container;
import eu.mihosoft.vmf.core.Contains;

interface Parent {

    @Contains(opposite = "parent")
    Child[] getChildren();

    String getName();
}

interface Child {
    @Container(opposite="children")
    Parent getParent();
    
    int getValue();
}

Just call the vmfGenModelSources task to generate the implementation.

To improve IDE support, enable the IntelliJ support via

buildscript {
  ext.vmfPluginIntelliJIntegration = true
}

Building VMF (Core)

Requirements

  • Java >= 1.8
  • Internet connection (dependencies are downloaded automatically)
  • IDE: Gradle Plugin (not necessary for command line usage)

IDE

Open the VMF core Gradle project in your favourite IDE (tested with IntelliJ 2019) and build it by calling the publishToMavenLocal task.

Command Line

Navigate to the VMF core Gradle project (i.e., path/to/VMF/core) and enter the following command

Bash (Linux/macOS/Cygwin/other Unix shell)

bash gradlew publishToMavenLocal

Windows (CMD)

gradlew publishToMavenLocal

Building VMF (Runtime)

IDE

Open the VMF runtime Gradle project in your favourite IDE (tested with NetBeans 8.2 and IntelliJ 2018) and build it by calling the publishToMavenLocal task.

Command Line

Navigate to the VMF runtime Gradle project (i.e., path/to/VMF/runtime) and enter the following command

Bash (Linux/macOS/Cygwin/other Unix shell)

bash gradlew publishToMavenLocal

Windows (CMD)

gradlew publishToMavenLocal    

Building VMF (Gradle Plugin)

IDE

Open the VMF Gradle plugin project in your favourite IDE (tested with NetBeans 8.2 and IntelliJ 2018) and build it by calling the publishToMavenLocal task.

Command Line

Navigate to the VMF runtime Gradle project (i.e., path/to/VMF/gradle-project) and enter the following command

Bash (Linux/macOS/Cygwin/other Unix shell)

bash gradlew publishToMavenLocal

Windows (CMD)

gradlew publishToMavenLocal 

Testing VMF (Core, Runtime & Plugin)

To execute the test suite, navigate to the test project (i.e., path/to/VMF/test-suite) and enter the following command

Bash (Linux/macOS/Cygwin/other Unix shell)

bash gradlew test

Windows (CMD)

gradlew test

This will use the latest snapshot vmf and gradle-plugin to execute the tests defined in the test-suite project.

Viewing the Report

An HTML version of the test report is located in the build folder test-suite/build/reports/tests/test/index.html.

About

VMF is a Lightweight Modeling Framework for the Java Platform (works on JDK 8-13)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 96.7%
  • Groovy 2.9%
  • Other 0.4%