summaryrefslogtreecommitdiffstats
path: root/src/de/fhswf/in/inf/se/projektthemenvergabe/model/Ansprechpartner.java
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2016-01-11 16:19:55 +0100
committerStefan Suhren <suhren.stefan@fh-swf.de>2016-01-11 16:57:15 +0100
commitd70f8574208a47242ef9fe1a715b575ff078c9a2 (patch)
tree671f0b3cb377a3f26e4fc21041923ed4c53c105a /src/de/fhswf/in/inf/se/projektthemenvergabe/model/Ansprechpartner.java
parent48c08e5df63e42eccef488a821d60348f5f15a75 (diff)
downloadProjektthemenvergabe-d70f8574208a47242ef9fe1a715b575ff078c9a2.tar.gz
Projektthemenvergabe-d70f8574208a47242ef9fe1a715b575ff078c9a2.zip
Enforce needed values via constructor
Diffstat (limited to 'src/de/fhswf/in/inf/se/projektthemenvergabe/model/Ansprechpartner.java')
-rw-r--r--src/de/fhswf/in/inf/se/projektthemenvergabe/model/Ansprechpartner.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/de/fhswf/in/inf/se/projektthemenvergabe/model/Ansprechpartner.java b/src/de/fhswf/in/inf/se/projektthemenvergabe/model/Ansprechpartner.java
index ce28c51..6a29db5 100644
--- a/src/de/fhswf/in/inf/se/projektthemenvergabe/model/Ansprechpartner.java
+++ b/src/de/fhswf/in/inf/se/projektthemenvergabe/model/Ansprechpartner.java
@@ -58,15 +58,44 @@ public class Ansprechpartner
* Constructor of Ansprechpartner.
*
* @param organisation
+ * The {@link Organisation} of the {@link Ansprechpartner}.
+ * @param vorname
+ * The vorname of the {@link Ansprechpartner}.
+ * @param nachname
+ * The nachname of the {@link Ansprechpartner}.
*/
- public Ansprechpartner(Organisation organisation)
+ public Ansprechpartner(Organisation organisation, String vorname,
+ String nachname)
{
+ if (vorname == null)
+ {
+ throw new IllegalArgumentException("Vorname can't be null.");
+ }
+
+ if (nachname == null)
+ {
+ throw new IllegalArgumentException("Nachname can't be null.");
+ }
+
+ if (vorname.isEmpty())
+ {
+ throw new IllegalArgumentException("Vorname can't be empty.");
+ }
+
+ if (nachname.isEmpty())
+ {
+ throw new IllegalArgumentException("Nachname can't be empty.");
+ }
+
this.organisation.set(organisation);
if (organisation != null)
{
this.organisation.get().addAnsprechpartner(this);
}
+
+ this.vorname.set(vorname);
+ this.nachname.set(nachname);
}
/**