import nl.strohalm.cyclos.entities.accounts.Currency; //导入方法依赖的package包/类

@Override

public ValidationError validate(final Object object, final Object property, final Object value) {

final TransferType transferType = (TransferType) object;

// Get source and destination account types

final AccountType from = fetchService.fetch(transferType.getFrom(), AccountType.Relationships.CURRENCY);

AccountType to = (AccountType) value;

// Validate if the currency of the source account type is the same currency of the destination account type

final Currency sourceAccountTypeCurrency = from.getCurrency();

to = fetchService.fetch(to, AccountType.Relationships.CURRENCY);

final Currency destinationAccountTypeCurrency = to.getCurrency();

if (!sourceAccountTypeCurrency.equals(destinationAccountTypeCurrency)) {

return new ValidationError("transferType.error.invalidDestinationType");

}

if (from != null && to != null) {

if (from.equals(to) && from.getNature() == AccountType.Nature.SYSTEM) {

// Cannot be from and to the same account if system

return new InvalidError();

}

if (transferType.isLoanType() && ((from.getNature() == AccountType.Nature.MEMBER) || (to.getNature() == AccountType.Nature.SYSTEM))) {

// When is a loan, can only be from system to member

return new InvalidError();

}

}

return null;

}

java currency 默认_Java Currency.equals方法代码示例相关推荐

  1. java secretkey用法_Java SecretKeyFactory.generateSecret方法代码示例

    本文整理汇总了Java中javax.crypto.SecretKeyFactory.generateSecret方法的典型用法代码示例.如果您正苦于以下问题:Java SecretKeyFactory ...

  2. java note项目_Java Request.setNote方法代码示例

    import org.apache.catalina.connector.Request; //导入方法依赖的package包/类 /** * Perform single-sign-on suppo ...

  3. java polygon 用法_Java Polygon.getBounds方法代码示例

    import java.awt.Polygon; //导入方法依赖的package包/类 private SelectionShape translatePointsToRealSize(Select ...

  4. java gettext用法_Java Label.getText方法代码示例

    import javafx.scene.control.Label; //导入方法依赖的package包/类 private void initVBox(){ ClassNode node = (Cl ...

  5. java settext用法_Java JFormattedTextField.setText方法代码示例

    import javax.swing.JFormattedTextField; //导入方法依赖的package包/类 /** * Creates a {@link JFormattedTextFie ...

  6. java makedir用法_Java Files.makeDir方法代码示例

    import org.nutz.lang.Files; //导入方法依赖的package包/类 protected void download(String openid, String media_ ...

  7. java args包_Java Args.positive方法代码示例

    import org.apache.http.util.Args; //导入方法依赖的package包/类 /** * Creates new instance of BHttpConnectionB ...

  8. java shape用法_Java PShape.scale方法代码示例

    import processing.core.PShape; //导入方法依赖的package包/类 public void updateAnim(){ if(pg_src_small == null ...

  9. java round指令_Java PApplet.round方法代码示例

    import processing.core.PApplet; //导入方法依赖的package包/类 public static final void updatePos() { if(follow ...

  10. java gettext用法_Java Context.getText方法代码示例

    import android.content.Context; //导入方法依赖的package包/类 /** * Song Details * * @param context * @param t ...

最新文章

  1. Ubuntu 16.04中安装VMware Tools
  2. 借助Docker单机秒开数十万TCP连接
  3. WinForm 修改App.config不起作用(但是调试没有异常)
  4. Cannot convert value of type 'com.sun.proxy.$Proxy10 implementing com.shuai.
  5. 四层和七层负载均衡的特点及常用负载均衡Nginx、Haproxy、LVS对比
  6. 《软件开发这点事儿》作者邵志东老师视频发布
  7. bzoj1355——2016——3——15
  8. 于群matlab仿真,33637《MATLAB-Simulink电力系统建模与仿真》于群(实例程序)
  9. 一个程序员的诗集【古诗篇】
  10. 1991年首批全国500位名老中医
  11. Alibaba Arthas快速入门 简单易懂
  12. 【微信每日早安推送】每日天气推送
  13. 2020 android 新功能,少了它,你就OUT了!2020年安卓旗舰手机 新技术盘点与展望
  14. python corpora.Dictionary corpus dictionary.doc2bow 词袋模型转为稀疏矩阵 词向量 不要词袋模型
  15. python网上下载视频,音乐
  16. 基于Opencv的图像卡通化
  17. 导出数据库的longblob
  18. Netflix 增长的逻辑——第二曲线(混沌2018年度大课笔记1)
  19. 面试加分项,10道海量数据处理,你会几道?
  20. 关于系统中的流水帐号

热门文章

  1. 专业项目管理软件统御项目管理系统V7.0(oKit)试用感受
  2. 【Vuforia】最佳实践:支持作为模型目标(Model Targets)的对象和CAD模型
  3. python——列表简介、操作列表
  4. matplotlib使用cmap
  5. java去除word修改痕迹_去除Word修订
  6. java做橡皮擦效果_顶风作案,html5 canvas实现橡皮擦功能,擦了就知道有惊喜了...
  7. Python哈希表的例子:dict、set
  8. PV-RCNN: Point-Voxel Feature Set Abstraction for 3D Object Detection(group的是关键点周围的体素,而不是周围的点)
  9. 漫画:什么是 “图”?
  10. [java] POI shiftRows 移动后合并的单元格被拆分了