net.sf.andromedaioc.bean.param.PlaceHolderValueParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of andromeda-ioc Show documentation
Show all versions of andromeda-ioc Show documentation
Inversion of Control Framework for Android
The newest version!
package net.sf.andromedaioc.bean.param;
import net.sf.andromedaioc.model.beans.ValueModel;
import net.sf.andromedaioc.resource.ResourceProvider;
/**
* Placeholders wrapper. Placeholders are used in xml context and can be used to specify
* resource or property value: ${R.id.text_field}, ${property_name}
*/
public class PlaceHolderValueParser extends AbstractConstantValueParser {
private final ValueModel valueModel;
private final ResourceProvider resourceProvider;
public PlaceHolderValueParser(ValueModel valueModel, Class> type, ResourceProvider resourceProvider) {
super(type);
this.valueModel = valueModel;
this.resourceProvider = resourceProvider;
}
@Override
protected Object getValue() {
return resourceProvider.getResource(valueModel.getValue());
}
}