示例#1
0
        protected static void reflectiveInit(SkillFile sf)
        {
            // create instances
            foreach (AbstractStoragePool t in sf.allTypesStream())
            {
                try
                {
                    for (int j = reflectiveInitSize; j != 0; j--)
                    {
                        t.make();
                    }
                }
                catch (SkillException e)
                {
                    // the type can not have more instances
                }
            }

            // set fields
            foreach (AbstractStoragePool t in sf.allTypesStream())
            {
                foreach (SkillObject o in t)
                {
                    StaticFieldIterator it = t.fields();
                    while (it.hasNext())
                    {
                        AbstractFieldDeclaration f = it.next();
                        if (!(f is IAutoField) && !(f.Type is IConstantIntegerType) && !(f is InterfaceField))
                        {
                            set <object, SkillObject>(sf, o, f);
                        }
                    }
                }
            }
        }
示例#2
0
 public static void loadAll(SkillFile skillFile)
 {
     foreach (IAccess t in skillFile.allTypes())
     {
         StaticFieldIterator fs = t.fields();
         while (fs.hasNext())
         {
             AbstractFieldDeclaration f = fs.next();
             if (f is ILazyField)
             {
                 ((ILazyField)f).ensureLoaded();
             }
         }
     }
 }