1 package org.apache.lucene.facet.index.attributes;
3 import java.util.Collection;
6 import org.apache.lucene.util.Attribute;
8 import org.apache.lucene.facet.taxonomy.CategoryPath;
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed with
13 * this work for additional information regarding copyright ownership.
14 * The ASF licenses this file to You under the Apache License, Version 2.0
15 * (the "License"); you may not use this file except in compliance with
16 * the License. You may obtain a copy of the License at
18 * http://www.apache.org/licenses/LICENSE-2.0
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
28 * An attribute which contains for a certain category the {@link CategoryPath}
29 * and additional properties.
31 * @lucene.experimental
33 public interface CategoryAttribute extends Attribute {
36 * Set the content of this {@link CategoryAttribute} from another
37 * {@link CategoryAttribute} object.
40 * The {@link CategoryAttribute} to take the content from.
42 public void set(CategoryAttribute other);
45 * Sets the category path value of this attribute.
48 * A category path. May not be null.
50 public void setCategoryPath(CategoryPath cp);
53 * Returns the value of this attribute: a category path.
55 * @return The category path last assigned to this attribute, or null if
56 * none has been assigned.
58 public CategoryPath getCategoryPath();
61 * Add a property. The property can be later retrieved using
62 * {@link #getProperty(Class)} with this property class .<br>
63 * Adding multiple properties of the same class is forbidden.
66 * The property to add.
67 * @throws UnsupportedOperationException
68 * When attempting to add a property of a class that was added
69 * before and merge is prohibited.
71 public void addProperty(CategoryProperty property)
72 throws UnsupportedOperationException;
75 * Get a property of a certain property class.
77 * @param propertyClass
78 * The required property class.
79 * @return The property of the given class, or null if no such property
82 public CategoryProperty getProperty(
83 Class<? extends CategoryProperty> propertyClass);
86 * Get a property of one of given property classes.
88 * @param propertyClasses
89 * The property classes.
90 * @return A property matching one of the given classes, or null if no such
93 public CategoryProperty getProperty(
94 Collection<Class<? extends CategoryProperty>> propertyClasses);
97 * Get all the active property classes.
99 * @return A set containing the active property classes, or {@code null} if
100 * there are no properties.
102 public Set<Class<? extends CategoryProperty>> getPropertyClasses();
105 * Clone this {@link CategoryAttribute}.
107 * @return A clone of this {@link CategoryAttribute}.
109 public CategoryAttribute clone();
112 * Resets this attribute to its initial value: a null category path and no
118 * Clear all properties.
120 public void clearProperties();
123 * Remove an property of a certain property class.
125 * @param propertyClass
126 * The required property class.
128 public void remove(Class<? extends CategoryProperty> propertyClass);