All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.andromedaioc.bean.param.PlaceHolderValueParser Maven / Gradle / Ivy

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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy