fields() public abstract méthode

public abstract fields ( ) : List
Résultat List
Exemple #1
0
        //////////////////////////////////////////////////////////////////////////
        // Complex
        //////////////////////////////////////////////////////////////////////////
        private void writeComplex(Type type, object obj, Serializable ser)
        {
            wType(type);

              bool first = true;
              object defObj = null;
              if (skipDefaults) defObj = FanObj.@typeof(obj).make();

              List fields = type.fields();
              for (int i=0; i<fields.sz(); ++i)
              {
            Field f = (Field)fields.get(i);

            // skip static, transient, and synthetic (once) fields
            if (f.isStatic() || f.isSynthetic() || f.hasFacet(Sys.TransientType))
              continue;

            // get the value
            object val = f.get(obj);

            // if skipping defaults
            if (defObj != null)
            {
              object defVal = f.get(defObj);
              if (OpUtil.compareEQ(val, defVal)) continue;
            }

            // if first then open braces
            if (first) { w('\n').wIndent().w('{').w('\n'); level++; first = false; }

            // field name =
            wIndent().w(f.name()).w('=');

            // field value
            curFieldType = f.type().toNonNullable();
            writeObj(val);
            curFieldType = null;

            w('\n');
              }

              // if collection
              if (ser.m_collection)
            first = writeCollectionItems(type, obj, first);

              // if we output fields, then close braces
              if (!first) { level--; wIndent().w('}'); }
        }