| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| StaticDefinitionSource |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2007 Ivan Dubrov | |
| 3 | * Copyright 2007 Robin Helgelin | |
| 4 | * | |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 | * you may not use this file except in compliance with the License. | |
| 7 | * You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | ||
| 18 | package nu.localhost.tapestry.acegi.services.internal; | |
| 19 | ||
| 20 | import java.util.Iterator; | |
| 21 | ||
| 22 | import org.acegisecurity.ConfigAttributeDefinition; | |
| 23 | import org.acegisecurity.intercept.method.MethodDefinitionSource; | |
| 24 | ||
| 25 | /** | |
| 26 | * Implementation of {@link MethodDefinitionSource} that simply casts security | |
| 27 | * object to the {@link ConfigAttributeDefinition}. | |
| 28 | * @author Ivan Dubrov | |
| 29 | */ | |
| 30 | 0 | public class StaticDefinitionSource implements MethodDefinitionSource { |
| 31 | /** | |
| 32 | * This implementation simply casts security object to the | |
| 33 | * {@link ConfigAttributeDefinition}. | |
| 34 | * @param object security object | |
| 35 | * @return security object casted to {@link ConfigAttributeDefinition}. | |
| 36 | */ | |
| 37 | public final ConfigAttributeDefinition getAttributes(final Object object) { | |
| 38 | 0 | return (ConfigAttributeDefinition) object; |
| 39 | } | |
| 40 | ||
| 41 | /** | |
| 42 | * Returns null. | |
| 43 | * @return null. | |
| 44 | */ | |
| 45 | public final Iterator getConfigAttributeDefinitions() { | |
| 46 | 0 | return null; |
| 47 | } | |
| 48 | ||
| 49 | /** | |
| 50 | * Returns true if clazz is extension of {@link ConfigAttributeDefinition}. | |
| 51 | * @param clazz the class that is being queried | |
| 52 | * @return true if clazz is extension of {@link ConfigAttributeDefinition}. | |
| 53 | */ | |
| 54 | public final boolean supports(final Class clazz) { | |
| 55 | 0 | return ConfigAttributeDefinition.class.isAssignableFrom(clazz); |
| 56 | } | |
| 57 | } |