Example #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);
                        }
                    }
                }
            }
        }
Example #2
0
        private static void set <T, Obj>(SkillFile sf, Obj o, AbstractFieldDeclaration f) where Obj : SkillObject
        {
            T v = value <T>(sf, ([email protected])f.Type);

            // System.out.printf("%s#%d.%s = %s\n", o.getClass().getName(),
            // o.getSkillID(), f.name(), v.toString());
            o.set(f, v);
        }
Example #3
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();
             }
         }
     }
 }