View Javadoc

1   /*
2    * Copyright 2008 University Corporation for Advanced Internet Development, Inc.
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  
17  package edu.internet2.middleware.shibboleth.common.config.attribute.resolver.attributeDefinition;
18  
19  import edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attributeDefinition.RegexSplitAttributeDefinition;
20  
21  /** Factory bean for creating regular expression based splitting attribute definitions. */
22  public class RegexSplitAttributeDefinitionFactoryBean extends BaseAttributeDefinitionFactoryBean {
23  
24      /** Regular expression used to split values. */
25      private String regex;
26      
27      /** Whether the regular expression is case sensitive. */
28      private boolean caseSensitive;
29  
30      /** {@inheritDoc} */
31      public Class getObjectType() {
32          return RegexSplitAttributeDefinition.class;
33      }
34  
35      /**
36       * Gets the regular expression used to split values.
37       * 
38       * @return regular expression used to split values
39       */
40      public String getRegex() {
41          return regex;
42      }
43  
44      /**
45       * Sets the regular expression used to split values.
46       * 
47       * @param regularExpression regular expression used to split values
48       */
49      public void setRegex(String regularExpression) {
50          regex = regularExpression;
51      }
52      
53      /**
54       * Gets whether the regular expression is case sensitive.
55       * 
56       * @return whether the regular expression is case sensitive
57       */
58      public boolean isCaseSensitive() {
59          return caseSensitive;
60      }
61      
62      /**
63       * Sets whether the regular expression is case sensitive.
64       * 
65       * @param isSensitive whether the regular expression is case sensitive
66       */
67      public void setCaseSensitive(boolean isSensitive) {
68          caseSensitive = isSensitive;
69      }
70  
71      /** {@inheritDoc} */
72      protected Object createInstance() throws Exception {
73          RegexSplitAttributeDefinition definition = new RegexSplitAttributeDefinition(regex, caseSensitive);
74          populateAttributeDefinition(definition);
75  
76          return definition;
77      }
78  }