/** * Gets a builder for the specified index. If no builder has been created for * that index, a builder is created on demand by calling * {@link Message#toBuilder}. * * @param index the index of the message to get * @return The builder for that index */ public BType getBuilder(int index) { ensureBuilders(); SingleFieldBuilderV3<MType, BType, IType> builder = builders.get(index); if (builder == null) { MType message = messages.get(index); builder = new SingleFieldBuilderV3<MType, BType, IType>( message, this, isClean); builders.set(index, builder); } return builder.getBuilder(); }
/** * Appends a new builder to the end of this list and returns the builder. * * @param message the message to add which is the basis of the builder * @return the new builder */ public BType addBuilder(MType message) { ensureMutableMessageList(); ensureBuilders(); SingleFieldBuilderV3<MType, BType, IType> builder = new SingleFieldBuilderV3<MType, BType, IType>( message, this, isClean); messages.add(null); builders.add(builder); onChanged(); incrementModCounts(); return builder.getBuilder(); }
/** * Inserts a new builder at the specified position in this list. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices). * * @param index the index at which to insert the builder * @param message the message to add which is the basis of the builder * @return the builder */ public BType addBuilder(int index, MType message) { ensureMutableMessageList(); ensureBuilders(); SingleFieldBuilderV3<MType, BType, IType> builder = new SingleFieldBuilderV3<MType, BType, IType>( message, this, isClean); messages.add(index, null); builders.add(index, builder); onChanged(); incrementModCounts(); return builder.getBuilder(); }
/** * Gets a builder for the specified index. If no builder has been created for * that index, a builder is created on demand by calling * {@link Message#toBuilder}. * * @param index the index of the message to get * @return The builder for that index */ public BType getBuilder(int index) { ensureBuilders(); SingleFieldBuilderV3<MType, BType, IType> builder = builders.get(index); if (builder == null) { MType message = messages.get(index); builder = new SingleFieldBuilderV3<MType, BType, IType>( message, this, isClean); builders.set(index, builder); } return builder.getBuilder(); }
/** * Appends a new builder to the end of this list and returns the builder. * * @param message the message to add which is the basis of the builder * @return the new builder */ public BType addBuilder(MType message) { ensureMutableMessageList(); ensureBuilders(); SingleFieldBuilderV3<MType, BType, IType> builder = new SingleFieldBuilderV3<MType, BType, IType>( message, this, isClean); messages.add(null); builders.add(builder); onChanged(); incrementModCounts(); return builder.getBuilder(); }
/** * Inserts a new builder at the specified position in this list. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices). * * @param index the index at which to insert the builder * @param message the message to add which is the basis of the builder * @return the builder */ public BType addBuilder(int index, MType message) { ensureMutableMessageList(); ensureBuilders(); SingleFieldBuilderV3<MType, BType, IType> builder = new SingleFieldBuilderV3<MType, BType, IType>( message, this, isClean); messages.add(index, null); builders.add(index, builder); onChanged(); incrementModCounts(); return builder.getBuilder(); }