黄潞潞
2024-06-07 482f807361c9bc0dce2db949a29c755cf858548b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package foundation.data.meta.property;
 
import foundation.data.meta.DataMetaCenter;
import foundation.data.meta.template.Index;
import foundation.json.IJSONProvider;
import foundation.json.IJSONWriter;
import foundation.util.MapList;
 
public class PropertysRuntime extends MapList<String, Property> implements IJSONProvider {
 
    private static DataMetaCenter container;
    private Index index;
    
    static {
        container = DataMetaCenter.getInstance();
    }
    
    protected PropertysRuntime(Index index) {
        this.index = index;
    }
 
    public static PropertysRuntime getInstance(MetaCode metaCode) {
        try {
            PropertysRuntime meta = container.getOnePropertyMetas(metaCode);
            return meta;
        }
        catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
 
    @Override
    public void writeJSON(IJSONWriter writer) {
        //1. 
        int[] idx = index.getValues();
        String[] names = index.getNames();
        
        //2.
        for (Property property: this) {
            property.writeJSON(writer, idx, names);
        }
    }
 
}