Getting Started

From zero to your first Glob in under five minutes.

Option 1 — Run the all-in-one example (fastest)

Clone the example repository (which includes all sub-modules as Git submodules) and run a self-contained demo that shows JSON, GraphQL, and database access working together:

git clone --recursive https://github.com/globsframework/globs-allInOne.git
cd globs-allInOne
mvn install -DskipTests

Then open and run: simplest/src/main/java/org/globsframework/sample/graphql/Example2.java

Option 2 — Add to your Maven project

Add the core dependency to your pom.xml:

<!-- Core — no runtime deps beyond slf4j -->
<dependency>
    <groupId>org.globsframework</groupId>
    <artifactId>globs</artifactId>
    <version>5.7</version>
</dependency>

Then add optional modules as needed:

<!-- JSON -->
<dependency>
    <groupId>org.globsframework</groupId>
    <artifactId>globs-gson</artifactId>
    <version>5.7</version>
</dependency>

<!-- SQL / JDBC -->
<dependency>
    <groupId>org.globsframework</groupId>
    <artifactId>globs-db</artifactId>
    <version>5.7</version>
</dependency>

<!-- HTTP server -->
<dependency>
    <groupId>org.globsframework</groupId>
    <artifactId>globs-http</artifactId>
    <version>5.7</version>
</dependency>

Option 3 — Build from source

Clone the individual repositories and build them with Maven:

# Core
git clone https://github.com/globsframework/globsframework.git
cd globsframework
mvn install -DskipTests

# JSON module
git clone https://github.com/globsframework/globs-gson.git
cd globs-gson
mvn install -DskipTests

Your first Glob

Step 1 — Define a type

import org.globsframework.core.metamodel.*;
import org.globsframework.core.metamodel.fields.*;

public class PersonType {
    public static final GlobType     TYPE;
    public static final StringField  name;
    public static final IntegerField age;
    public static final StringField  email;

    static {
        GlobTypeBuilder b = GlobTypeBuilderFactory.create("Person");
        name  = b.declareStringField("name");
        age   = b.declareIntegerField("age");
        email = b.declareStringField("email");
        TYPE  = b.build();
    }
}

Step 2 — Create and populate a Glob

import org.globsframework.core.model.*;

MutableGlob person = PersonType.TYPE.instantiate()
    .set(PersonType.name,  "Alice")
    .set(PersonType.age,   30)
    .set(PersonType.email, "alice@example.com");

System.out.println(person.get(PersonType.name)); // Alice

Step 3 — Serialize to JSON

import org.globsframework.json.GSonUtils; // globs-gson module

String json = GSonUtils.encode(person, false);
// {"name":"Alice","age":30,"email":"alice@example.com"}

Glob fromJson = GSonUtils.decode(json, PersonType.TYPE);
System.out.println(fromJson.get(PersonType.age)); // 30

Step 4 — Iterate fields generically

for (Field field : person.getType().getFields()) {
    if (person.isSet(field) && !person.isNull(field)) {
        System.out.println(field.getName() + " = " + person.getValue(field));
    }
}
// name = Alice
// age  = 30
// email = alice@example.com
The loop above works for any GlobType — you never have to update it when you add or remove a field.

Next steps

Core Concepts

Understand GlobType, Field, annotations, and the set-vs-null distinction in depth.

Ecosystem

Browse all available modules — JSON, XML, SQL, HTTP, GraphQL, gRPC, CLI, binary, and more.

Examples

See the same type definition drive JSON, a SQL database, an HTTP server, and nested data structures.

All-in-one repo ↗

Runnable samples that combine multiple modules in a single Maven project.