Gridarta Editor
AttributeRangeError.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2015 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.validation.errors;
21 
25 import org.jetbrains.annotations.NotNull;
26 import org.jetbrains.annotations.Nullable;
27 
32 public class AttributeRangeError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends GameObjectValidationError<G, A, R> {
33 
37  private static final long serialVersionUID = 1L;
38 
43  @NotNull
44  private final String attributeName;
45 
50  @NotNull
51  private final String curValue;
52 
57  @NotNull
58  private final String minValue;
59 
64  @NotNull
65  private final String maxValue;
66 
75  public AttributeRangeError(@NotNull final G gameObject, @NotNull final String attributeName, @NotNull final String curValue, @NotNull final String minValue, @NotNull final String maxValue) {
76  super(gameObject);
77  this.attributeName = attributeName;
78  this.curValue = curValue;
79  this.minValue = minValue;
80  this.maxValue = maxValue;
81  }
82 
83  @Nullable
84  @Override
85  public String getParameter(final int id) {
86  switch (id) {
87  case 0:
88  return attributeName;
89 
90  case 1:
91  return curValue;
92 
93  case 2:
94  return minValue;
95 
96  case 3:
97  return maxValue;
98 
99  default:
100  return null;
101  }
102  }
103 
104 }
Class for validation errors related to an GameObject.
AttributeRangeError(@NotNull final G gameObject, @NotNull final String attributeName, @NotNull final String curValue, @NotNull final String minValue, @NotNull final String maxValue)
Create a new instance.
final String curValue
The current (incorrect) attribute value.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Definition: GameObject.java:36
final String attributeName
The suspicious attribute name.
GameObjects are the objects based on Archetypes found on maps.
Indicate an attribute value that is out of range.
static final long serialVersionUID
The serial version UID.
final String maxValue
The maximal allowed attribute value.
final String minValue
The minimal allowed attribute value.