Search in sources :

Example 11 with TSInterfaceType

use of io.crnk.gen.typescript.model.TSInterfaceType in project crnk-framework by crnk-project.

the class TSWriter method sortAndAppendTypes.

private void sortAndAppendTypes(Set<TSInterfaceType> types) {
    List<TSInterfaceType> sorted = new ArrayList<>(types);
    Collections.sort(sorted, new Comparator<TSInterfaceType>() {

        @Override
        public int compare(TSInterfaceType type0, TSInterfaceType type1) {
            return type0.getName().compareTo(type1.getName());
        }
    });
    Iterator<TSInterfaceType> iterator = sorted.iterator();
    while (iterator.hasNext()) {
        TSInterfaceType implementedInterface = iterator.next();
        visitReference(implementedInterface);
        if (iterator.hasNext()) {
            builder.append(", ");
        }
    }
}
Also used : ArrayList(java.util.ArrayList) TSInterfaceType(io.crnk.gen.typescript.model.TSInterfaceType)

Aggregations

TSInterfaceType (io.crnk.gen.typescript.model.TSInterfaceType)11 MetaDataObject (io.crnk.meta.model.MetaDataObject)5 TSModule (io.crnk.gen.typescript.model.TSModule)4 TSClassType (io.crnk.gen.typescript.model.TSClassType)3 Test (org.junit.Test)3 TSElement (io.crnk.gen.typescript.model.TSElement)2 TSField (io.crnk.gen.typescript.model.TSField)2 MetaResource (io.crnk.meta.model.resource.MetaResource)2 TSContainerElement (io.crnk.gen.typescript.model.TSContainerElement)1 TSIndexSignature (io.crnk.gen.typescript.model.TSIndexSignature)1 TSType (io.crnk.gen.typescript.model.TSType)1 MetaAttribute (io.crnk.meta.model.MetaAttribute)1 MetaElement (io.crnk.meta.model.MetaElement)1 MetaKey (io.crnk.meta.model.MetaKey)1 MetaResourceRepository (io.crnk.meta.model.resource.MetaResourceRepository)1 ArrayList (java.util.ArrayList)1