use of org.robobinding.viewbinding.BindingAttributeMappings in project RoboBinding by RoboBinding.
the class ViewBindingObjectClassGen method defineMapBindingAttributesMethod.
/**
* @Override
* public void mapBindingAttributes(BindingAttributeMappings<ImageView> mappings) {
* mappings.mapOneWayProperty(ImageAlphaAttribute.class, "imageAlpha");
* mappings.mapOneWayProperty(MaxWidthAttribute.class, "maxWidth");
* mappings.mapOneWayProperty(MaxHeightAttribute.class, "maxHeight");
*
* customViewBinding.mapBindingAttributes(mappings);
* }
*/
public void defineMapBindingAttributesMethod() {
JMethod method = definedClass.method(JMod.PUBLIC, codeModel.VOID, "mapBindingAttributes");
method.annotate(Override.class);
AbstractJClass bindingAttributeMappingsType = codeModel.ref(BindingAttributeMappings.class).narrow(viewClass);
JVar mappingsParam = method.param(bindingAttributeMappingsType, "mappings");
JBlock body = method.body();
for (SimpleOneWayPropertyInfo info : simpleOneWayPropertyInfoList) {
body.invoke(mappingsParam, "mapOneWayProperty").arg(info.getBindingClass().dotclass()).arg(info.propertyName());
}
body.invoke(customViewBindingFieldWithoutThis, "mapBindingAttributes").arg(mappingsParam);
}
Aggregations