@Override public boolean hasNext() { return pos < source.size(); } @Override
@Override public void remove() { if (source.remove(pos-1)) { pos--; } } }
@Override public IORequestBuilder<Out> setHeader(final String header, final String value) { headers.setValue(header, value); return this; }
protected AbstractClass addInnerClasses(Iterable<IsClass> clses) { for (IsClass cls : clses) { innerClasses.give(cls); } return this; }
@Override public String register(final Class<? extends Model> model) { final String typeName = getTypeName(model); classToTypeName.put(model, typeName); typeNameToClass.put(typeName, model); final ModelSerializer serializer = getSerializer(typeName); serializers.put(typeName, serializer); return typeName; }
@Override public T next() { return source.at(pos++); } @Override
/** * @param receiver - The receiver to remove. */ public void removeReceiver(ReceivesValue<T> receiver){ handlers.remove(receiver); }
/** * Clear our array of callbacks */ public void clearReceivers(){ handlers.clear(); } /**
public ListOf() { this(CollectionOptions.asMutableList().build()); } public ListOf(CollectionOptions opts) {
public static <K, V> void copyDictionary(final Dictionary<K, V> from,final Dictionary<K,V> into) { from.forKeys(new ReceivesValue<K>() { @Override public void set(final K key) { into.setValue(key, from.getValue(key)); } }); } public static <K, V> void copyInto(final HasValues<K, V> from, final HasValues<K, V> into) {
@Override public Model removeProperty(final String key) { map.remove(key); return this; }
@Override public void clear() { map.clear(); max = 0; }
public CollectionOptions build() { return new CollectionOptions( concurrent, forbidsDuplicate, insertionOrdered, mutable); } }
protected AbstractClass addMethods(Iterable<IsMethod> methods) { for (IsMethod method : methods) this.methods.give(method); return this; } protected AbstractClass setMethods(Iterable<IsMethod> methods) {
@SuppressWarnings("unchecked") protected Self addAnnotations(Iterable<IsAnnotation> annos) { for (IsAnnotation anno : annos) annotations.give(anno); return (Self)this; } @SuppressWarnings("unchecked")
/** * Push a handler onto our callback stack * * @param handle - Handler to be called on remove * @return - this, for chaining */ public RemovesMultiHandlers addHandler(RemovalHandler handle){ handles.give(handle); return this; }
/** * Adds a callback that will be fired before the main and post callback stacks * * @param receiver - The receiver to add to pre-fire stack * @param top - true to unshift onto head, false to push onto tail */ public void addPre(ReceivesValue<T> receiver){ assert receiver != null : "Do not send null receivers to "+this+"; (ReceivesMultiValue.addBefore) "; assert receiver != this : "Do not send a ReceivesMultiValue to itself. Class: "+this+";"; pre.give(receiver); } /**
/** * Adds a callback that will be fired after the pre and main callback stacks * * @param receiver - The receiver to add to pre-fire stack * @param top - true to unshift onto head, false to push onto tail */ public void addPost(ReceivesValue<T> receiver){ assert receiver != null : "Do not send null receivers to "+this+"; (ReceivesMultiValue.addAfter) "; assert receiver != this : "Do not send a ReceivesMultiValue to itself. Class: "+this+";"; post.give(receiver); } /**