use of org.androidannotations.internal.core.model.AndroidSystemServices in project androidannotations by androidannotations.
the class SystemServiceHandler method assignValue.
@Override
public void assignValue(JBlock targetBlock, IJAssignmentTarget fieldRef, EComponentHolder holder, Element element, Element param) {
TypeMirror serviceType = param.asType();
String fieldTypeQualifiedName = serviceType.toString();
JFieldRef serviceRef = new AndroidSystemServices(getEnvironment()).getServiceConstantRef(serviceType);
if (CanonicalNameConstants.APP_WIDGET_MANAGER.equals(fieldTypeQualifiedName)) {
targetBlock.add(fieldRef.assign(createSpecialInjection(holder, fieldTypeQualifiedName, serviceRef, 21, "LOLLIPOP", getClasses().APP_WIDGET_MANAGER, "getInstance", true)));
} else {
targetBlock.add(fieldRef.assign(createNormalInjection(holder, fieldTypeQualifiedName, serviceRef)));
}
}
use of org.androidannotations.internal.core.model.AndroidSystemServices in project androidannotations by androidannotations.
the class ValidatorHelper method androidService.
public void androidService(Element element, ElementValidation valid) {
Element targetElement = findTargetElement(element, valid);
if (targetElement == null) {
return;
}
AndroidSystemServices androidSystemServices = new AndroidSystemServices(environment());
TypeMirror serviceType = targetElement.asType();
if (!androidSystemServices.contains(serviceType)) {
valid.addError("Unknown service type: " + serviceType.toString());
}
}
Aggregations