|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| SecurityConfig.java | 100% | 100% | 100% | 100% |
|
||||||||||||||
| 1 | /* Copyright 2004 Acegi Technology Pty Limited | |
| 2 | * | |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 | * you may not use this file except in compliance with the License. | |
| 5 | * You may obtain a copy of the License at | |
| 6 | * | |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 | * | |
| 9 | * Unless required by applicable law or agreed to in writing, software | |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 | * See the License for the specific language governing permissions and | |
| 13 | * limitations under the License. | |
| 14 | */ | |
| 15 | ||
| 16 | package org.acegisecurity; | |
| 17 | ||
| 18 | /** | |
| 19 | * Stores a {@link ConfigAttribute} as a <code>String</code>. | |
| 20 | * | |
| 21 | * @author <A HREF="mailto:ben.alex@fremerx.com">Ben Alex</A> | |
| 22 | * @version $Id: SecurityConfig.java,v 1.4 2005/11/17 00:55:49 benalex Exp $ | |
| 23 | */ | |
| 24 | public class SecurityConfig implements ConfigAttribute { | |
| 25 | //~ Instance fields ======================================================== | |
| 26 | ||
| 27 | private String attrib; | |
| 28 | ||
| 29 | //~ Constructors =========================================================== | |
| 30 | ||
| 31 | 555 | public SecurityConfig(String config) { |
| 32 | 555 | this.attrib = config; |
| 33 | } | |
| 34 | ||
| 35 | 1 | protected SecurityConfig() { |
| 36 | 1 | throw new IllegalArgumentException("Cannot use default constructor"); |
| 37 | } | |
| 38 | ||
| 39 | //~ Methods ================================================================ | |
| 40 | ||
| 41 | 556 | public String getAttribute() { |
| 42 | 556 | return this.attrib; |
| 43 | } | |
| 44 | ||
| 45 | 101 | public boolean equals(Object obj) { |
| 46 | 101 | if (obj instanceof String) { |
| 47 | 5 | return obj.equals(this.attrib); |
| 48 | } | |
| 49 | ||
| 50 | 96 | if (obj instanceof ConfigAttribute) { |
| 51 | 95 | ConfigAttribute attr = (ConfigAttribute) obj; |
| 52 | ||
| 53 | 95 | return this.attrib.equals(attr.getAttribute()); |
| 54 | } | |
| 55 | ||
| 56 | 1 | return false; |
| 57 | } | |
| 58 | ||
| 59 | 57 | public int hashCode() { |
| 60 | 57 | return this.attrib.hashCode(); |
| 61 | } | |
| 62 | ||
| 63 | 109 | public String toString() { |
| 64 | 109 | return this.attrib; |
| 65 | } | |
| 66 | } |
|
||||||||||