Package com.softwaremill.common.cdi.autofactory.producer

Source Code of com.softwaremill.common.cdi.autofactory.producer.ExamplePriceCalculatorProducer

package com.softwaremill.common.cdi.autofactory.producer;

import com.softwaremill.common.cdi.autofactory.PriceCalculator;
import com.softwaremill.common.cdi.autofactory.Product;

import javax.enterprise.inject.Produces;
import javax.inject.Inject;

/**
* @author Adam Warski (adam at warski dot org)
*/
public class ExamplePriceCalculatorProducer {
    private final PriceCalculator.Factory priceCalculatorFactory;

    @Inject
    public ExamplePriceCalculatorProducer(PriceCalculator.Factory priceCalculatorFactory) {
        this.priceCalculatorFactory = priceCalculatorFactory;
    }

    @Produces @ExampleProductQualifier
    public PriceCalculator create() {
        return priceCalculatorFactory.create(new Product(0));
    }
}
TOP

Related Classes of com.softwaremill.common.cdi.autofactory.producer.ExamplePriceCalculatorProducer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.