productcatalog.java

来自「某本RUP经典书籍的示例工程的部分代码实现,内含有一个Junit测试用例」· Java 代码 · 共 24 行

JAVA
24
字号
package com.foo.nextgen.domain;
import java.util.HashMap;
import java.util.Map;
public class ProductCatalog {
	private Map<ItemID,ProductDescription>
	        descriptions = new HashMap<ItemID,ProductDescription>();
	public ProductCatalog()
	{
		ItemID id1=new ItemID(100);
		ItemID id2=new ItemID(200);
		Money price=new Money(3);
		 
		ProductDescription desc;
		desc = new ProductDescription(id1,price,"product 1");
		descriptions.put(id1,desc);
		desc = new ProductDescription(id2,price,"product 2");
		descriptions.put(id2,desc);		
	}
	public ProductDescription getProductDescription(ItemID id)
	{
		return descriptions.get(id);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?