📄 defaultlender.java
字号:
/* * $Id: DefaultLender.java 10669 2008-02-01 15:27:01Z romikk $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.example.loanbroker.lender;import org.mule.example.loanbroker.bank.Bank;import org.mule.example.loanbroker.messages.CreditProfile;import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest;/** * <code>DefaultLenderService</code> is responsible for contacting the relivant * banks depending on the amount of the loan */public class DefaultLender implements LenderService{ /** * Sets the list of lenders on the LoanBrokerQuoteRequest and returns it. */ public void setLenderList(LoanBrokerQuoteRequest request) { Bank[] lenders = getLenders(request.getCreditProfile(), new Double(request.getCustomerRequest() .getLoanAmount())); request.setLenders(lenders); } /** * @inheritDocs */ public Bank[] getLenders(CreditProfile creditProfile, Double loanAmount) { // TODO Add creditProfile info. to the logic below. // TODO Look up the existing banks from the config/registry instead of // creating them programatically here. Bank[] lenders; if ((loanAmount.doubleValue() >= 20000)) { lenders = new Bank[2]; lenders[0] = new Bank("Bank1"); lenders[1] = new Bank("Bank2"); } else if (((loanAmount.doubleValue() >= 10000) && (loanAmount.doubleValue() <= 19999))) { lenders = new Bank[2]; lenders[0] = new Bank("Bank3"); lenders[1] = new Bank("Bank4"); } else { lenders = new Bank[1]; lenders[0] = new Bank("Bank5"); } return lenders; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -