protected <T> Schema<T> newSchema(Class<T> typeClass)
    {
        if (primaryGroup == null)
            return RuntimeSchema.createFrom(typeClass, this);

        final Schema<T> s = primaryGroup.getSchemaWrapper(typeClass, true).getSchema();

        // only pojos created by runtime schema support groups
        if (!(s instanceof RuntimeSchema))
            return s;

        final RuntimeSchema<T> rs = (RuntimeSchema<T>) s;

        // check if we need to filter
        if (rs.getFieldCount() == 0)
            return rs;

        final ArrayList<Field<T>> fields = new ArrayList<Field<T>>(rs.getFieldCount());
        
        int copyCount = 0;
        for (Field<T> f : rs.getFields())
        {
            final int groupFilter = f.groupFilter;
            if (groupFilter != 0)
            {
                final int set; // set for exclusion
                if (groupFilter > 0)
                {
                    // inclusion
                    set = ~groupFilter & 0x7FFFFFFF;
                }
                else
                {
                    // exclusion
                    set = -groupFilter;
                }

                if (0 != (groupId & set))
                {
                    // this field is excluded on the current group id
                    continue;
                }
            }
            
            if (f != (f = f.copy(this)))
                copyCount++;

            fields.add(f);
        }

        // The behavior has been changed to always allow messages with zero fields
        // regardless if it has a primary group or not.
        /*if (fields.size() == 0)
        {
            throw new RuntimeException("All fields were excluded for "
                    + rs.messageFullName() + " on group " + groupId);
        }*/

        return copyCount == 0 && fields.size() == rs.getFieldCount() ? rs :
                new RuntimeSchema<T>(typeClass, fields, rs.instantiator);
    }
Generates a schema from the given class. If this strategy is part of a group, the existing fields of that group's
schema will be re-used.
protostuff-runtime/src/main/java/io/protostuff/runtime/IdStrategy.java