001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.12 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * Exceptions thrown by some libSBML constructors. 013 <p> 014 * <p style='color: #777; font-style: italic'> 015This class of objects is defined by libSBML only and has no direct 016equivalent in terms of SBML components. This class is not prescribed by 017the SBML specifications, although it is used to implement features 018defined in SBML. 019</p> 020 021 <p> 022 * In some situations, constructors for SBML objects may need to indicate 023 * to callers that the creation of the object failed. The failure may be 024 * for different reasons, such as an attempt to use invalid parameters or a 025 * system condition such as a memory error. To communicate this to 026 * callers, those classes will throw an {@link XMLConstructorException}. 027 <p> 028 * In languages that don't have an exception mechanism (e.g., C), the 029 * constructors generally try to return an error code instead of throwing 030 * an exception. 031 <p> 032 * @see SBMLConstructorException 033 */ 034 035public class XMLConstructorException extends java.lang.IllegalArgumentException { 036 private long swigCPtr; 037 protected boolean swigCMemOwn; 038 039 protected XMLConstructorException(long cPtr, boolean cMemoryOwn) 040 { 041 swigCMemOwn = cMemoryOwn; 042 swigCPtr = cPtr; 043 } 044 045 protected static long getCPtr(XMLConstructorException obj) 046 { 047 return (obj == null) ? 0 : obj.swigCPtr; 048 } 049 050 protected static long getCPtrAndDisown (XMLConstructorException obj) 051 { 052 long ptr = 0; 053 054 if (obj != null) 055 { 056 ptr = obj.swigCPtr; 057 obj.swigCMemOwn = false; 058 } 059 060 return ptr; 061 } 062 063 protected void finalize() { 064 delete(); 065 } 066 067 public synchronized void delete() { 068 if (swigCPtr != 0) { 069 if (swigCMemOwn) { 070 swigCMemOwn = false; 071 libsbmlJNI.delete_XMLConstructorException(swigCPtr); 072 } 073 swigCPtr = 0; 074 } 075 } 076 077 /* 078 * To pass the message from an exception to the parent exception class, 079 * we have to create our own variant of the constructor that takes an 080 * extra string argument. 081 */ 082 protected XMLConstructorException(long cPtr, boolean cMemoryOwn, String v) 083 { 084 super(v); 085 swigCMemOwn = cMemoryOwn; 086 swigCPtr = cPtr; 087 } 088 089 /* 090 * Next, we define the public constructor to take a string (like all basic 091 * Java exception class constructors), and invoke our internal special 092 * constructor with the extra argument. 093 */ 094 public XMLConstructorException(String v) 095 { 096 this(libsbmlJNI.new_XMLConstructorException(), true, v); 097 } 098 099 100/** * @internal */ public 101 XMLConstructorException() { 102 this(libsbmlJNI.new_XMLConstructorException(), true); 103 } 104 105}