/**
* Name of product
*/
- private final String name;
+ private String name;
/**
* Price of product
*/
- private final float price;
+ private float price;
/**
* Title of product
*/
- private final String title;
+ private String title;
/**
* Constructor for products with a name and a price.
* @param price Price
*/
public PizzaProduct (final String name, final String title, final float price) {
- this.name = name;
- this.title = title;
- this.price = price;
+ this.setName(name);
+ this.setTitle(title);
+ this.setPrice(price);
}
/**
* @return the name
*/
@Override
- public String getName () {
+ public final String getName () {
return this.name;
}
+ /**
+ * Name of product
+ * @param name the name to set
+ */
+ protected final void setName (final String name) {
+ this.name = name;
+ }
+
/**
* Price of product
* @return the price
*/
@Override
- public Float getPrice () {
+ public final float getPrice () {
return this.price;
}
+ /**
+ * Price of product
+ * @param price the price to set
+ */
+ protected final void setPrice (final float price) {
+ this.price = price;
+ }
+
/**
* Title of product
* @return the title
*/
@Override
- public String getTitle () {
+ public final String getTitle () {
return this.title;
}
+ /**
+ * Title of product
+ * @param title the title to set
+ */
+ protected final void setTitle (final String title) {
+ this.title = title;
+ }
+
/**
* Whether this product is choosen (default: false)
*
* @return the choosen
*/
@Override
- public boolean isChoosen () {
+ public final boolean isChoosen () {
return this.choosen;
}
+ /**
+ * Whether this product is choosen (default: false)
+ * @param choosen the choosen to set
+ */
+ protected final void setChoosen (boolean choosen) {
+ this.choosen = choosen;
+ }
+
/**
* Marks product as choosen
*/
public void markAsChoosen () {
// Set it
this.getLogger().debug(MessageFormat.format("product={0} marked as choosen.", this.getName()));
- this.choosen = true;
+ this.setChoosen(true);
}
}