1 package org.apache.archiva.repository.features;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
25 * The repository feature holds information about specific features. The may not be available by all repository implementations.
26 * Features should be simple objects for storing additional data, the should not implement too much functionality.
27 * Additional functionality the uses the information in the feature objects should be implemented in the specific repository
28 * provider and repository implementations, or in the repository registry if it is generic.
30 * But features may throw events, if it's data is changed.
33 * This interface is to get access to a concrete feature by accessing the generic interface.
35 * @param <T> the concrete feature implementation.
37 * @author Martin Stockhammer <martin_s@apache.org>
40 public interface RepositoryFeature<T extends RepositoryFeature<T>> {
43 * Unique Identifier of this feature. Each feature implementation has its own unique identifier.
45 * @return the identifier string which should be unique for the implementation class.
47 default String getId() {
48 return this.getClass().getName();
52 * Tells, if this instance is a feature of the given identifier.
54 * @param featureId the feature identifier string to check
55 * @return true, if this instance is a instance with the feature id, otherwise <code>false</code>
57 default boolean isFeature(String featureId) {
58 return this.getClass().getName().equals(featureId);
62 * Tells, if the this instance is a feature of the given feature class.
64 * @param clazz The class to check against.
65 * @param <K> the concrete feature implementation.
68 default <K extends RepositoryFeature<K>> boolean isFeature(Class<K> clazz) {
69 return this.getClass().equals(clazz);
73 * Returns the concrete feature instance.
74 * @return the feature instance.