Gridarta Editor
NotInsideContainerException.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.gameobject;
21 
24 import org.jetbrains.annotations.NotNull;
25 import org.jetbrains.annotations.Nullable;
26 
34 public class NotInsideContainerException extends IllegalStateException {
35 
39  private static final long serialVersionUID = 1L;
40 
46  @Nullable
48 
54  @NotNull
56 
63  this(null, item);
64  }
65 
74  super(container == null ? item + " was expected to be inside a container but wasn't." : item + " was expected to be inside " + container + " but was in " + item.getContainer());
75  this.container = container;
76  this.item = item;
77  }
78 
85  @NotNull
87  return item;
88  }
89 
95  @Nullable
97  return container;
98  }
99 
100 }
net.sf.gridarta.model.gameobject.NotInsideContainerException.getItem
BaseObject<?, ?, ?, ?> getItem()
Returns the game object that was not inside a container but should have been.
Definition: NotInsideContainerException.java:86
net.sf.gridarta.model.gameobject.NotInsideContainerException.NotInsideContainerException
NotInsideContainerException(@NotNull final GameObject<?, ?, ?> item)
Creates a new instance.
Definition: NotInsideContainerException.java:62
net.sf.gridarta
Base package of all Gridarta classes.
net.sf
net.sf.gridarta.model.gameobject.NotInsideContainerException.getContainer
GameObjectContainer<?, ?, ?> getContainer()
Returns the container that the GameObject was expected in.
Definition: NotInsideContainerException.java:96
net.sf.gridarta.model.gameobject.NotInsideContainerException.serialVersionUID
static final long serialVersionUID
The serial version UID.
Definition: NotInsideContainerException.java:39
net
net.sf.gridarta.model.baseobject.BaseObject
Definition: BaseObject.java:34
net.sf.gridarta.model.gameobject.NotInsideContainerException.item
final BaseObject<?, ?, ?, ?> item
The GameObject that was not inside a / the container but should have been.
Definition: NotInsideContainerException.java:55
net.sf.gridarta.model.gameobject.NotInsideContainerException
This exception is thrown in case a method of a GameObject without a container or the wrong container ...
Definition: NotInsideContainerException.java:34
net.sf.gridarta.model
net.sf.gridarta.model.baseobject
Definition: AbstractBaseObject.java:20
net.sf.gridarta.model.gameobject.NotInsideContainerException.NotInsideContainerException
NotInsideContainerException(@Nullable final GameObjectContainer<?, ?, ?> container, @NotNull final GameObject<?, ?, ?> item)
Creates a new instance.
Definition: NotInsideContainerException.java:73
net.sf.gridarta.var.crossfire.model.gameobject.GameObject<?, ?, ?>
net.sf.gridarta.model.baseobject.GameObjectContainer
Base class for classes that contain GameObjects as children in the sense of containment.
Definition: GameObjectContainer.java:50
net.sf.gridarta.model.gameobject.NotInsideContainerException.container
final GameObjectContainer<?, ?, ?> container
The expected container if != null or null if expected to be in any container.
Definition: NotInsideContainerException.java:47