use of org.androidannotations.holder.FoundPreferenceHolder in project androidannotations by androidannotations.
the class AbstractPreferenceListenerHandler method assignListeners.
@Override
protected final void assignListeners(HasPreferences holder, List<JFieldRef> idsRefs, JDefinedClass listenerAnonymousClass) {
for (JFieldRef idRef : idsRefs) {
FoundPreferenceHolder foundPreferenceHolder = holder.getFoundPreferenceHolder(idRef, getListenerTargetClass(holder));
foundPreferenceHolder.getIfNotNullBlock().invoke(foundPreferenceHolder.getRef(), getSetterName()).arg(_new(listenerAnonymousClass));
}
}
use of org.androidannotations.holder.FoundPreferenceHolder in project androidannotations by androidannotations.
the class PreferenceByKeyHandler method assignValue.
@Override
public void assignValue(JBlock targetBlock, IJAssignmentTarget fieldRef, HasPreferences holder, Element element, Element param) {
TypeMirror prefFieldTypeMirror = param.asType();
String typeQualifiedName = prefFieldTypeMirror.toString();
JFieldRef idRef = annotationHelper.extractOneAnnotationFieldRef(element, IRClass.Res.STRING, true);
AbstractJClass preferenceClass = getJClass(typeQualifiedName);
IJAssignmentTarget preferenceHolderTarget = null;
if (element.getKind() == ElementKind.FIELD) {
preferenceHolderTarget = fieldRef;
}
FoundPreferenceHolder preferenceHolder = holder.getFoundPreferenceHolder(idRef, preferenceClass, preferenceHolderTarget);
if (!preferenceHolder.getRef().equals(preferenceHolderTarget)) {
targetBlock.add(fieldRef.assign(preferenceHolder.getOrCastRef(preferenceClass)));
}
}
Aggregations