/** * get the exact module data. * @return the module data. */ public final T getData(){ return getBaseMediator()._getTarget(); } /**
/** * get the exact module data. * @return the module data. */ public final T getData(){ return getBaseMediator()._getTarget(); } /**
/** * add property with it's value. * @param prop the property * @param value the value of property * @return this. */ public BatchApplier addProperty(Property prop, Object value) { Throwables.checkNull(prop); if(!mInterceptor.shouldIntercept(mMediator._getTarget(), prop, value)) { this.mProps.add(prop); this.mValue.add(value); } return this; }
/** * add property with it's value. * @param prop the property * @param value the value of property * @return this. */ public BatchApplier addProperty(Property prop, Object value) { Throwables.checkNull(prop); if(!mInterceptor.shouldIntercept(mMediator._getTarget(), prop, value)) { this.mProps.add(prop); this.mValue.add(value); } return this; }
/** * apply the data to target consumer. * @param consumer the data consumer * @since 1.1.2 */ public void applyTo(DataConsumer<? super T> consumer){ Throwables.checkNull(consumer); consumer.accept(_getTarget()); } /**
/** * apply the data to target consumer. * @param consumer the data consumer * @since 1.1.2 */ public void applyTo(DataConsumer<? super T> consumer){ Throwables.checkNull(consumer); consumer.accept(_getTarget()); } /**
/** * batch apply the properties with theirs' value. */ @SuppressWarnings("unchecked") public void apply() { final T data = mMediator._getTarget(); final DataMediatorCallback[] arrLocal = mMediator._getCallbacks(); final int size = mProps.size(); PropertyCallbackContext.Params params = new PropertyCallbackContext.Params(data, 0); DataMediatorCallback callback; for (int i = arrLocal.length - 1; i >= 0; i--) { callback = arrLocal[i]; for (int j = 0; j < size; j++) { callback.onPreCallback(params); callback.onPropertyApplied(data, mProps.get(j), mValue.get(j)); callback.onPostCallback(); } } } }
/** * batch apply the properties with theirs' value. */ @SuppressWarnings("unchecked") public void apply() { final T data = mMediator._getTarget(); final DataMediatorCallback[] arrLocal = mMediator._getCallbacks(); final int size = mProps.size(); PropertyCallbackContext.Params params = new PropertyCallbackContext.Params(data, 0); DataMediatorCallback callback; for (int i = arrLocal.length - 1; i >= 0; i--) { callback = arrLocal[i]; for (int j = 0; j < size; j++) { callback.onPreCallback(params); callback.onPropertyApplied(data, mProps.get(j), mValue.get(j)); callback.onPostCallback(); } } } }
@Override @SuppressWarnings("unchecked") public void onPropertyValueChanged(T data, Property prop, Object oldValue, Object newValue) { if (data != mMediator._getTarget()) { return; } final List<FamilyGroup> mss = mGroups.get(TYPE_MASTER_SLAVE); final List<FamilyGroup> brothers = mGroups.get(TYPE_BROTHER); if (Predicates.isEmpty(mss) && Predicates.isEmpty(brothers)) { return; } if (!Predicates.isEmpty(mss)) { for (FamilyGroup fg : mss) { if (fg.master.contains(prop)) { fg.callbackByMasterSlave(prop, newValue, mMediator, mEvaluator); } } } if (!Predicates.isEmpty(brothers)) { for (FamilyGroup fg : brothers) { if (fg.master.contains(prop)) { fg.callbackByBrother(prop, newValue, mMediator, mEvaluator, mForbid); } } } }
@Override @SuppressWarnings("unchecked") public void onPropertyValueChanged(T data, Property prop, Object oldValue, Object newValue) { if (data != mMediator._getTarget()) { return; } final List<FamilyGroup> mss = mGroups.get(TYPE_MASTER_SLAVE); final List<FamilyGroup> brothers = mGroups.get(TYPE_BROTHER); if (Predicates.isEmpty(mss) && Predicates.isEmpty(brothers)) { return; } if (!Predicates.isEmpty(mss)) { for (FamilyGroup fg : mss) { if (fg.master.contains(prop)) { fg.callbackByMasterSlave(prop, newValue, mMediator, mEvaluator); } } } if (!Predicates.isEmpty(brothers)) { for (FamilyGroup fg : brothers) { if (fg.master.contains(prop)) { fg.callbackByBrother(prop, newValue, mMediator, mEvaluator, mForbid); } } } }