Removed DOCUMENT ME comments that were generated and applied source code
[utils] / security / src / main / java / org / wamblee / security / authorization / RegexpPathCondition.java
1 /*
2  * Copyright 2005 the original author or authors.
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 org.wamblee.security.authorization;
17
18 import org.wamblee.persistence.AbstractPersistent;
19
20 /**
21  * Condition to check whether a path matches a given regula expression.
22  * 
23  * @author Erik Brakkee
24  */
25 public class RegexpPathCondition extends AbstractPersistent implements
26     PathCondition {
27     /**
28      * String the path must start with.
29      */
30     private String pattern;
31
32     /**
33      * Constructs the condition.
34      * 
35      * @param aPattern
36      *            String the path must start with.
37      */
38     public RegexpPathCondition(String aPattern) {
39         pattern = aPattern;
40     }
41
42     /**
43      * For OR mapping.
44      * 
45      */
46     protected RegexpPathCondition() {
47         pattern = null;
48     }
49
50     /*
51      * (non-Javadoc)
52      * 
53      * @see
54      * org.wamblee.security.authorization.PathCondition#matches(java.lang.String
55      * )
56      */
57     public boolean matches(String aPath) {
58         return aPath.matches(pattern);
59     }
60
61     /**
62      * 
63      * @return Returns the _path.
64      */
65     protected String getPattern() {
66         return pattern;
67     }
68
69     /**
70      * 
71      * @param aPattern
72      *            The _path to set.
73      */
74     protected void setPattern(String aPattern) {
75         pattern = aPattern;
76     }
77
78     /*
79      * (non-Javadoc)
80      * 
81      * @see java.lang.Object#toString()
82      */
83     @Override
84     public String toString() {
85         return "RegexpCondition(pattern = '" + pattern + "')";
86     }
87 }