tinystruct is a lightweight Java framework designed to simplify application development by emphasizing simplicity and performance. It seamlessly supports both command-line tools and APIs, enabling developers to create robust solutions with ease. Its core philosophy is encapsulated in the motto: 'Simplicity is difficult, while complexity is easy. Better thinking leads to better design.'
Add the dependency into your pom.xml.
<dependency>
<groupId>org.tinystruct</groupId>
<artifactId>tinystruct</artifactId>
<version>1.5.1</version>
<classifier>jar-with-dependencies</classifier>
</dependency>
Extend the AbstractApplication in Java
package tinystruct.examples;
import org.tinystruct.AbstractApplication;
import org.tinystruct.ApplicationException;
import org.tinystruct.system.annotation.Action;
public class example extends AbstractApplication {
@Override
public void init() {
// TODO Auto-generated method stub
}
@Override
public String version() {
return "1.0";
}
@Action("praise")
public String praise() {
return "Praise the Lord!";
}
@Action("say")
public String say() throws ApplicationException {
if (null != getContext().getAttribute("--words"))
return getContext().getAttribute("--words").toString();
throw new ApplicationException("Could not find the parameter words.");
}
@Action("say")
public String say(String words) {
return words;
}
}
tinystruct focuses on reducing unnecessary complexity in application development. Its lightweight, modular nature makes it an excellent choice for developers looking for a straightforward, efficient framework for various Java-based projects.