1 /*
2 * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package de.smartics.properties.tutorial.property.constraints;
17
18 import javax.validation.constraints.Max;
19 import javax.validation.constraints.Min;
20 import javax.validation.groups.Default;
21
22 import de.smartics.properties.api.core.annotations.AccessType;
23 import de.smartics.properties.api.core.annotations.PropertyLifecycle;
24 import de.smartics.properties.api.core.annotations.PropertySet;
25 import de.smartics.properties.api.core.domain.PropertyKey;
26 import de.smartics.validation.constraints.groups.Startup;
27
28 /**
29 * A sample property set for the {@link PropertyConstraintsWithGroupsTutorial}.
30 */
31 @PropertySet(value = "tutorial.property.constraints.group")
32 public interface GroupConstraintsProperties
33 {
34 /**
35 * A value with a minimum and maximum level, but this time the constraint that
36 * checks the value is associated with the {@link Startup} constraint group.
37 * <p>
38 * The minimum value is <code>3</code>, but the maximum value is only set in
39 * the startup.
40 * </p>
41 */
42 @Min(value = 3)
43 @Max(value = 10, groups = { Startup.class })
44 @PropertyLifecycle(access = AccessType.READ_WRITE)
45 int startupGroup();
46
47 PropertyKey startupGroupPropertyKey();
48
49 /**
50 * Min and Max are active in the default group.
51 */
52 @Min(value = 3)
53 @Max(value = 10, groups = { Default.class })
54 @PropertyLifecycle(access = AccessType.READ_WRITE)
55 int defaultGroup();
56
57 PropertyKey defaultGroupPropertyKey();
58 }