001/* 002 * jPOS Project [http://jpos.org] 003 * Copyright (C) 2000-2026 jPOS Software SRL 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Affero General Public License as 007 * published by the Free Software Foundation, either version 3 of the 008 * License, or (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Affero General Public License for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018 019package org.jpos.rc; 020 021import java.util.Objects; 022 023/** 024 * Result Code implementation 025 */ 026public class SimpleRC implements RC { 027 private String rc; 028 private String display; 029 030 private SimpleRC() { 031 032 } 033 034 public SimpleRC(String rc) { 035 this.rc = rc; 036 if (rc == null) 037 throw new NullPointerException (); 038 } 039 040 public SimpleRC (String rc, String display) { 041 this(rc); 042 this.display = display; 043 } 044 public String rc() { 045 return rc; 046 } 047 public String display() { 048 return display; 049 } 050 051 @Override 052 public boolean equals(Object o) { 053 if (this == o) return true; 054 if (o == null || getClass() != o.getClass()) return false; 055 SimpleRC simpleRC = (SimpleRC) o; 056 return Objects.equals(rc, simpleRC.rc) && 057 Objects.equals(display, simpleRC.display); 058 } 059 060 @Override 061 public int hashCode() { 062 return Objects.hash(rc, display); 063 } 064 065 @Override 066 public String toString() { 067 return "SimpleRC{" + 068 "rc='" + rc + '\'' + 069 ", display='" + display + '\'' + 070 '}'; 071 } 072}