All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.jmi.reflect.AlreadyExistsException Maven / Gradle / Ivy

There is a newer version: 2.18.10
Show newest version
package javax.jmi.reflect;

/** Exception thrown by refCreateInstance and create methods
 * when a client attempts to create the second instance of a singleton.
 * 
I think we should rather return the existing instance of singleton * from the create method without throwing this exception. This behaviour is * more common for singletons. */ @SuppressWarnings("serial") public class AlreadyExistsException extends JmiException { private final RefObject existing; /** * Constructs new AlreadyExistsException without detail message. * @param existing existing singleton instance */ public AlreadyExistsException(RefObject existing) { super(existing.refMetaObject()); this.existing = existing; } /** * Constructs an AlreadyExistsException with the specified detail message. * @param existing existing singleton instance * @param msg the detail message. */ public AlreadyExistsException(RefObject existing, String msg) { super(existing.refMetaObject(), msg); this.existing = existing; } /** * Returns existing instance of singleton. * @return existing singleton instance */ public RefObject getExistingInstance() { return existing; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy