title: How to get entity relationship with annotations using testing class?
body: <p>I have created a simple Spring-boot application with two entities as <code>Company.java</code> and <code>User.java</code>. These two has <code>@OneToMany</code> relationship. And I have a created a test file for generating typescript file with printing those two entity's attributes. Here is the my test case.</p>
  
  <pre><code>@Inject
  RepositoryRestMvcConfiguration configuration;
  
  @Test
  public void getEndPoints() {
      configuration.resourceMappings().forEach(c -&gt; {
  
          String className = c.getDomainType().getName();
          try {
              Class&lt;?&gt; entityClass = Class.forName(className);
              Field[] fields = entityClass.getDeclaredFields();
  
              File tsClassDir = new File("data/tsClass");
              File tsClass = new File(tsClassDir, entityClass.getSimpleName() + ".ts");
  
              if (!tsClass.getParentFile().exists()) {
                  tsClass.getParentFile().mkdirs();
              }
  
              tsClass.createNewFile();
  
              String code = "export interface " + entityClass.getSimpleName() + "{\n";
  
              for (Field field : fields) {
                  try {
                      NotNull notNullAnnotation = field.getDeclaredAnnotation(NotNull.class);
                      Class&lt;?&gt; filedClass = Class.forName(field.getType().getName());
                      if (notNullAnnotation == null){
                          code += "\t" + field.getName() + "?: " + filedClass.getSimpleName().trim() + ";" + "\n";
                      }else{
                          code += "\t" + field.getName() + ": " + filedClass.getSimpleName().trim() + ";" + "\n";
                      }                       
  
                  } catch (Exception e) {
                      // TODO: handle exception
                  }
  
                  // System.err.println(field.getName());
              }
  
              code += "}";
  
              Files.write(tsClass.toPath(), code.getBytes());
  
              System.err.println(code);
          } catch (Exception e) {
              // TODO: handle exception
          }
      });
  }
  </code></pre>
  
  <p>After test run I got the result given below.</p>
  
  <pre><code>export interface User{
    userName: String;
    password: String;
    email: String;
    company?: Company;
  }
  export interface Company{
    name: String;
    email: String;
    users?: Set;
  }
  </code></pre>
  
  <p>But I need to print that <code>Company</code> and <code>User</code> has <code>@OneToMany</code> relationship in the typescript file. How do I do that?</p>