|
1 | 1 | package org.rcsb.cif.model; |
2 | 2 |
|
3 | 3 | import java.util.Collections; |
| 4 | +import java.util.List; |
4 | 5 | import java.util.Map; |
5 | 6 | import java.util.function.Function; |
6 | 7 | import java.util.stream.Stream; |
@@ -28,11 +29,24 @@ public interface Category { |
28 | 29 | */ |
29 | 30 | Column<?> getColumn(String name); |
30 | 31 |
|
| 32 | + /** |
| 33 | + * Retrieve the names of all columns. The use-case of this method is to inquire about present columns in an |
| 34 | + * efficient way: be aware that access via {@link Category#getColumns()} |
| 35 | + * @return an ordered set containing all registered columns |
| 36 | + */ |
| 37 | + List<String> getColumnNames(); |
| 38 | + |
31 | 39 | default <C extends Column<?>> C getColumn(String name, Function<Column<?>, C> wrapper) { |
32 | 40 | Column<?> column = getColumn(name); |
33 | 41 | return wrapper.apply(column != null ? column : new Column.EmptyColumn(name)); |
34 | 42 | } |
35 | 43 |
|
| 44 | + /** |
| 45 | + * Access to all columns in this category. Invoking this method ensures that all binary columns are decoded. Call |
| 46 | + * this only if you are fine with this. Otherwise use {@link Category#getColumnNames()} to access registered columns |
| 47 | + * and {@link Category#getColumn(String)} to retrieve single columns efficiently. |
| 48 | + * @return a map of all columns (key: column_name, value: column). |
| 49 | + */ |
36 | 50 | Map<String, Column<?>> getColumns(); |
37 | 51 |
|
38 | 52 | /** |
@@ -80,5 +94,10 @@ public Column<Void> getColumn(String name) { |
80 | 94 | public Map<String, Column<?>> getColumns() { |
81 | 95 | return Collections.emptyMap(); |
82 | 96 | } |
| 97 | + |
| 98 | + @Override |
| 99 | + public List<String> getColumnNames() { |
| 100 | + return Collections.emptyList(); |
| 101 | + } |
83 | 102 | } |
84 | 103 | } |
0 commit comments