file drop support
- Add a folder where you can drop Zip files which will then be extracted on the fly and ingsted. - CsvReaderSettings now contain TagMatcher that are applied to the first line and can be used to extract additional tags. - Update to jdk 16 so that we can have records.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package org.lucares.pdb.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
@@ -26,12 +28,13 @@ public class Tags implements Comparable<Tags> {
|
||||
tags = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Tags(final List<Tag> tags) {
|
||||
Collections.sort(tags, TagByKeyAndValueComparator.INSTANCE);
|
||||
this.tags = tags;
|
||||
public Tags(final Collection<Tag> tags) {
|
||||
final List<Tag> t = new ArrayList<>(tags);
|
||||
Collections.sort(t, TagByKeyAndValueComparator.INSTANCE);
|
||||
this.tags = t;
|
||||
}
|
||||
|
||||
public static Tags create(final List<Tag> tags) {
|
||||
public static Tags create(final Collection<Tag> tags) {
|
||||
|
||||
return new Tags(tags);
|
||||
}
|
||||
@@ -139,6 +142,20 @@ public class Tags implements Comparable<Tags> {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new {@link Tags} with the tags from {@code this} and the tags from
|
||||
* {@code tags}, possibly overwriting tags of {@code this}.
|
||||
*
|
||||
* @param tags the new tags
|
||||
* @return {@link Tags}
|
||||
*/
|
||||
public Tags add(final Tags tags) {
|
||||
final Set<Tag> result = new HashSet<>();
|
||||
result.addAll(this.tags);
|
||||
result.addAll(tags.toTags());
|
||||
return Tags.create(result);
|
||||
}
|
||||
|
||||
public String getValue(final String key) {
|
||||
final Tag needle = new Tag(STRING_COMPRESSOR.put(key), 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user