> For the complete documentation index, see [llms.txt](https://rasnesakam.gitbook.io/depin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rasnesakam.gitbook.io/depin/advanced.md).

# Advanced

This page covers general purpose of usage scenarios for our project

When we have complex class structures and relations, we can simply represent them as some formats such as JSON.

Here is a simple example of the situation:

```json
[
    {
        "id": "myCat",
        "target": "com.example.Cat"
        "args":[":s/Pamuk",":i/5"]
    },
    {
        "id": "myDog",
        "target": "com.example.Dog"
        "fields": [
            {"name":"name","value":":s/Karabaş"},
            {"name":"age", "value":":i/4"}
        ]
    },
    {
        "id": "catndog",
        "target":"com.example.CatNDog"
        "fields":[
            {"name":"cat", "value":"@myCat"},
            {"name":"dog", "value":"@myDog"},
        ]
    }
]
```

This JSON file represents our class structures and relations with each other. DepIn can read this file and generates instances of the classes that described there.

```java
DepIn depIn = DepIn.JsonContext("src/test/resources/classmap.json");


// Creates Cat object, Dog object, CatNDog object
// and injects Cat and Dog object into CatNDog object
CatNDog catndog = depIn.getInstance("@catndog");

// Creates a cat instance with defined parameters in json file
Cat tekir = depIn.getInstance("@mycat");
```
