001 package org.nakedobjects.applib.security;
002
003 import org.nakedobjects.applib.annotation.MemberOrder;
004 import org.nakedobjects.applib.annotation.NotPersistable;
005
006 @NotPersistable
007 public final class RoleMemento {
008
009
010 /**
011 * Creates a new role with the specified name. Description is left blank.
012 */
013 public RoleMemento(final String name) {
014 this(name, "");
015 }
016
017 /**
018 * Creates a new role with the specified name and description.
019 */
020 public RoleMemento(final String name, final String description) {
021 if (name == null) {
022 throw new IllegalArgumentException("Name not specified");
023 }
024 this.name = name;
025 if (description == null) {
026 throw new IllegalArgumentException("Description not specified");
027 }
028 this.description = description;
029 }
030
031
032 // {{ Identification
033 public String title() {
034 return name;
035 }
036 // }}
037
038 // {{ Name
039 private final String name;
040 @MemberOrder(sequence="1.1")
041 public String getName() {
042 return name;
043 }
044 // }}
045
046 // {{ Description
047 private final String description;
048 @MemberOrder(sequence="1.2")
049 public String getDescription() {
050 return description;
051 }
052 // }}
053 }
054 // Copyright (c) Naked Objects Group Ltd.