OpenSPCoop2MessageParseResult.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */

  20. package org.openspcoop2.message;

  21. import org.openspcoop2.message.exception.ParseException;

  22. /**
  23.  * OpenSPCoop2MessageParseResult
  24.  *
  25.  *
  26.  * @author Poli Andrea (apoli@link.it)
  27.  * @author $Author$
  28.  * @version $Rev$, $Date$
  29.  */
  30. public class OpenSPCoop2MessageParseResult {

  31.     private OpenSPCoop2Message message;
  32.     private ParseException parseException;

  33.     public OpenSPCoop2Message getMessage_throwParseThrowable() throws Throwable {
  34.         if(this.parseException!=null){
  35.             throw this.parseException.getSourceException();    
  36.         }
  37.         return this.message;
  38.     }
  39.     public OpenSPCoop2Message getMessage_throwParseException() throws Exception {
  40.         if(this.parseException!=null){
  41.             if(this.parseException.getSourceException() instanceof Exception){
  42.                 throw (Exception) this.parseException.getSourceException();
  43.             }else if(this.parseException.getSourceException() instanceof RuntimeException){
  44.                 throw (RuntimeException) this.parseException.getSourceException();
  45.             }
  46.             else{
  47.                 throw new RuntimeException(this.parseException.getSourceException());
  48.             }
  49.                
  50.         }
  51.         return this.message;
  52.     }
  53.    
  54.     public OpenSPCoop2Message getMessage() {
  55.         return this.message;
  56.     }
  57.     public void setMessage(OpenSPCoop2Message message) {
  58.         this.message = message;
  59.     }
  60.     public ParseException getParseException() {
  61.         return this.parseException;
  62.     }
  63.     public void setParseException(ParseException parseException) {
  64.         this.parseException = parseException;
  65.     }
  66. }