@Override
    protected int getId(Class<?> clazz)
    {
        int id;
        if (Message.class.isAssignableFrom(clazz))
        {
            final BaseHS<?> wrapper = getBaseHS(clazz, true);

            // wait till everything is completely set
            while (0 == (id = wrapper.id))
                LockSupport.parkNanos(1);

            return (id << 5) | CID_POJO;
        }

        if (Map.class.isAssignableFrom(clazz))
        {
            if (EnumMap.class.isAssignableFrom(clazz))
                return CID_ENUM_MAP;

            final RuntimeMapFactory factory = getRuntimeMapFactory(clazz);

            // wait till everything is completely set
            while (0 == (id = factory.id))
                LockSupport.parkNanos(1);

            return (id << 5) | CID_MAP;
        }

        if (Collection.class.isAssignableFrom(clazz))
        {
            if (EnumSet.class.isAssignableFrom(clazz))
                return CID_ENUM_SET;

            final RuntimeCollectionFactory factory = getRuntimeCollectionFactory(clazz);

            // wait till everything is completely set
            while (0 == (id = factory.id))
                LockSupport.parkNanos(1);

            return (id << 5) | CID_COLLECTION;
        }

        final BaseHS<?> wrapper = getBaseHS(clazz, true);

        // wait till everything is completely set
        while (0 == (id = wrapper.id))
            LockSupport.parkNanos(1);

        return (id << 5) | CID_POJO;
    }
Register a {@link Delegate} and assign an id.
<p>
Delegate ids start at 1.
protostuff-runtime-registry/src/main/java/io/protostuff/runtime/IncrementalIdStrategy.java