GettingStarted

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Getting started with ConfigureMe

To get started with ConfigureMe you need three things. First you need something to configure which we call configurable. Than you need something to configure your configurable with, that'll be the configuration. And finally you need to ask the ConfigurationManager to configure your configurable with your configuration somewhere in your code.

Lets get concrete. Imagine you are opening a fast food restaurant. To make it real fast you offer just one product. Since you are a great developer you are writing the software for your cash box yourself, and you want the price to come from a configuration file to be able to react to the financial crises fast.

First of all we need an object to store the prices, our configurable object:

Unknown macro: {code title=Pricing.java|borderStyle=solid}

package pricing;

import org.configureme.annotations.Configure;
import org.configureme.annotations.ConfigureMe;

@ConfigureMe
public class Pricing {
@Configure private String currency;
@Configure private float price;

public void setCurrency(String aCurrency)

Unknown macro: { currency = aCurrency; }

public void setPrice(float aPrice)

Unknown macro: { price = aPrice; }

public String getProductPrice()

Unknown macro: { return price+" "+currency; }

}


  • No labels