/** * 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); } /**
protected AbstractClass addInnerClasses(Iterable<IsClass> clses) { for (IsClass cls : clses) { innerClasses.give(cls); } return this; }
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; }
protected AbstractClass addInterface(IsClass iface) { interfaces.give(iface); return this; }
@Override protected AbstractClass addAnnotations(Iterable<IsAnnotation> annos) { for (IsAnnotation anno : annos) annotations.give(anno); return this; }
protected AbstractClass addMethod(IsMethod method) { this.methods.give(method); return this; } protected AbstractClass addMethods(Iterable<IsMethod> methods) {
protected AbstractClass addFields(Iterable<IsField> fields) { for (IsField field : fields) this.fields.give(field); return this; } protected AbstractClass addField(IsField field) {
protected AbstractClass addGenerics(Iterable<IsGeneric> generics) { for (IsGeneric generic : generics) { this.generics.give(generic); } return this; }
protected AbstractClass addInterfaces(Iterable<IsClass> ifaces) { for (IsClass iface : ifaces) interfaces.give(iface); return this; }
public void addThrowable(Throwable exception) { throwables.give(exception); }
protected AbstractClass addField(IsField field) { this.fields.give(field); return this; }
/** * Adds a receiver to the end of the callback array. * * @param receiver - A new receiver to add * @return true if the receiver was added to our callbacks; false if already present. */ public boolean addReceiver(ReceivesValue<T> receiver){ assert receiver != null : "Do not send null receivers to "+this+"; (ReceivesMultiValue) "; assert receiver != this : "Do not send a ReceivesMultiValue to itself. Class: "+this+";"; if (handlers.contains(receiver)) return false; handlers.give(receiver); return true; }
protected final void accept(ReceivesValue<T> callback){ if (callback!=null) pending().give(callback); }
public final void add(ProvidesValue<ReceivesValue<X>> provider){ assert !providers.contains(provider) : new RuntimeException("You have sent the same provider instance to a DeferredMultiReceiver more than once: "+provider); providers.give(provider); } public final void add(final ReceivesValue<X> provider){
public synchronized void forwardTo(LineReader callback) { X_Log.debug(getClass(),getClass().getName(),"forwardingTo", callback.getClass().getName(),":", callback); if (b != null) {// not null only after we have started streaming callback.onStart(); for (String line : X_String.splitNewLine(b.toString())) { callback.onLine(line); } } delegates.give(callback); if (finished) { callback.onEnd(); } }
public final void add(final ReceivesValue<X> provider){ ProviderAdapter<X> adapter = new ProviderAdapter<X>(); adapter.set(provider); providers.give(adapter); }
public Iterable<ModelField> getAllSerializable() { final Fifo<ModelField> fifo = X_Collect.newFifo(); for (final ModelField field : fields.values()) { final Serializable serial = field.getSerializable(); if (serial == null) { final ClientToServer c2s = field.getClientToServer(); if (c2s != null && c2s.enabled()) { fifo.give(field); continue; } final ServerToClient s2c = field.getServerToClient(); if (s2c != null && s2c.enabled()) { fifo.give(field); continue; } } else { // class is marked serializable fifo.give(field); } } return fifo.forEach(); }