• 大小: 13.72MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-30
  • 语言: 其他
  • 标签: demo示例  

资源简介

领域模型代码示例

资源截图

代码片段和文件信息

package marlon.banking.ddd;

import java.math.BigDecimal;

import marlon.banking.ddd.application.TransferFacade;
import marlon.banking.ddd.domain.model.Account;
import marlon.banking.ddd.domain.model.AccountUnderflowException;
import marlon.banking.ddd.domain.service.AccountNotExistedException;

import org.springframework.context.support.ClassPathxmlApplicationContext;

public class Main {
public static void main(String[] args) {
String[] configPaths = {
“context-datasource.xml“
“ddd/context-persistence-hibernate.xml“
“ddd/context-services.xml“
“ddd/context-facades.xml“
};
ClassPathxmlApplicationContext context = new ClassPathxmlApplicationContext(configPaths);

TransferFacade transferFacade = (TransferFacade) context.getBean(“transferFacade“ TransferFacade.class);
Account fromAccount = transferFacade.createAccount(“A“ new BigDecimal(“3250“));
Account toAccount = transferFacade.createAccount(“B“ new BigDecimal(“55.5“));

try {
transferFacade.transfer(fromAccount.getAccountId() toAccount.getAccountId() new BigDecimal(“2000“));
} catch (AccountNotExistedException e) {
e.printStackTrace();
} catch (AccountUnderflowException e) {
e.printStackTrace();
}

System.out.println(fromAccount.getAccountId() + “ has balance: “ + transferFacade.getBalance(fromAccount.getAccountId()));
System.out.println(toAccount.getAccountId() + “ has balance: “ + transferFacade.getBalance(toAccount.getAccountId()));
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2566  2014-11-26 22:50  ddddemo\.classpath

     文件        383  2014-11-26 20:35  ddddemo\.project

     文件         88  2014-11-26 21:04  ddddemo\.settings\org.eclipse.core.resources.prefs

     文件         83  2014-11-26 21:04  ddddemo\.settings\org.eclipse.core.runtime.prefs

     文件       1130  2014-11-26 21:55  ddddemo\bin\context-datasource.xml

     文件       1478  2008-11-30 17:56  ddddemo\bin\ddd\context-facades.xml

     文件       1206  2014-11-26 22:57  ddddemo\bin\ddd\context-persistence-hibernate.xml

     文件        419  2008-11-30 16:02  ddddemo\bin\ddd\context-services.xml

     文件       1268  2014-11-27 22:16  ddddemo\bin\ddd\hibernate-mappings.hbm.xml

     文件        479  2008-11-30 13:36  ddddemo\bin\log4j.properties

     文件        605  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\application\TransferFacade.class

     文件       1841  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\application\TransferFacadeImpl.class

     文件       2146  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\model\Account.class

     文件        414  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\model\AccountRepository.class

     文件        954  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\model\AccountUnderflowException.class

     文件       1198  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\model\LimitedOverdraftPolicy.class

     文件        957  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\model\NoOverdraftPolicy.class

     文件        232  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\model\OverdraftPolicy.class

     文件       1418  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\model\TransferTransaction.class

     文件        304  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\model\TransferTransactionRepository.class

     文件        883  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\service\AccountNotExistedException.class

     文件        434  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\service\TransferService.class

     文件       1932  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\domain\service\TransferServiceImpl.class

     文件       1876  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\infrastructure\persistence\AccountRepositoryHibernate.class

     文件       1494  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\infrastructure\persistence\TransferTransactionRepositoryHibernate.class

     文件       2596  2014-11-26 22:50  ddddemo\bin\marlon\banking\ddd\Main.class

     文件          0  2008-11-30 17:57  ddddemo\bin\marlon\banking\ddd\package.html

     文件        366  2014-11-26 22:50  ddddemo\bin\marlon\banking\ts\dao\AccountDAO.class

     文件       1760  2014-11-26 22:50  ddddemo\bin\marlon\banking\ts\dao\impl\AccountDAOHibernate.class

     文件       1394  2014-11-26 22:50  ddddemo\bin\marlon\banking\ts\dao\impl\TransferTransactionDAOHibernate.class

............此处省略145个文件信息

评论

共有 条评论

相关资源