Skip to content

Commit

Permalink
MET-5684 Record type
Browse files Browse the repository at this point in the history
  • Loading branch information
stzanakis committed Dec 19, 2023
1 parent 0417bbe commit 78b7be9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@
/**
* This is the default implementation of the vocabulary importing functionality.
*/
final class VocabularyCollectionImporterImpl implements VocabularyCollectionImporter {

private final Location directoryLocation;

VocabularyCollectionImporterImpl(Location directoryLocation) {
this.directoryLocation = directoryLocation;
}
record VocabularyCollectionImporterImpl(Location directoryLocation) implements VocabularyCollectionImporter {

@Override
public Iterable<VocabularyLoader> importVocabularies() throws VocabularyImportException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private <T extends AboutType> Set<SearchTermContext> getFieldValueSet(FieldType<
.add(fieldType));
}
return fieldValueFieldTypesMap.entrySet().stream().map(
entry -> new SearchTermContext(entry.getKey().getValue(), entry.getKey().getLanguage(),
entry -> new SearchTermContext(entry.getKey().value(), entry.getKey().language(),
entry.getValue())).collect(Collectors.toSet());
}

Expand Down Expand Up @@ -139,7 +139,7 @@ private static Set<String> getSameAsLinks(AboutType contextualClass) {
} else if (contextualClass instanceof PlaceType placeType) {
result = placeType.getSameAList();
} else if (contextualClass instanceof TimeSpanType timeSpanType) {
result = timeSpanType.getSameAList();
result = ((TimeSpanType) contextualClass).getSameAList();
} else {
result = null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,5 @@
package eu.europeana.enrichment.api.internal;

import java.util.Objects;
public record FieldValue(String value, String language) {

public final class FieldValue {

private final String value;
private final String language;

public FieldValue(String value, String language) {
this.value = value;
this.language = language;
}

public String getValue() {
return value;
}

public String getLanguage() {
return language;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final FieldValue that = (FieldValue) o;
return Objects.equals(value, that.value) && Objects.equals(language, that.language);
}

@Override
public int hashCode() {
return Objects.hash(value, language);
}
}

0 comments on commit 78b7be9

Please sign in to comment.