@Override
        public <T> Registry registerDelegate(Delegate<T> delegate, int id)
        {
            if (id < 1)
                throw new IllegalArgumentException("delegate ids start at 1.");

            if (id >= strategy.delegates.size())
                grow(strategy.delegates, id + 1);
            else if (strategy.delegates.get(id) != null)
            {
                throw new IllegalArgumentException("Duplicate id registration: " + id +
                        " (" + delegate.typeClass() + ")");
            }

            RegisteredDelegate<T> rd = new RegisteredDelegate<T>(id, delegate, strategy);
            strategy.delegates.set(id, rd);
            // just in case
            if (strategy.delegateMapping.put(delegate.typeClass(), rd) != null)
                throw new IllegalArgumentException("Duplicate registration for: " + delegate.typeClass());

            return this;
        }
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