add lambdas to logging API

This commit is contained in:
Jörg Prante 2020-05-05 20:23:17 +02:00
parent b123d27567
commit 970f62f44f
10 changed files with 10 additions and 11 deletions

View file

@ -1,6 +1,6 @@
group = org.xbib group = org.xbib
name = marc name = marc
version = 2.2.0 version = 2.2.1
# main # main
xbib-content.version = 2.0.5 xbib-content.version = 2.0.5

View file

@ -114,7 +114,7 @@ public enum BibliographicLevel {
case 's': case 's':
return SERIAL; return SERIAL;
default: default:
logger.log(Level.FINEST, "unknown bibliographic level: " + ch); logger.log(Level.FINEST, () -> "unknown bibliographic level: " + ch);
return UNSPECIFIED; return UNSPECIFIED;
} }
} }

View file

@ -81,7 +81,7 @@ public enum DescriptiveCatalogingForm {
case 'u': case 'u':
return UNKNOWN; return UNKNOWN;
default: default:
logger.log(Level.FINEST, "unknown descriptive cataloging form: " + ch); logger.log(Level.FINEST, () -> "unknown descriptive cataloging form: " + ch);
return NON_ISBD; return NON_ISBD;
} }
} }

View file

@ -63,7 +63,7 @@ public enum Encoding {
case 'a': case 'a':
return UCS_UNICODE; return UCS_UNICODE;
default: default:
logger.log(Level.FINEST, "unknown encoding: " + ch); logger.log(Level.FINEST, () -> "unknown encoding: " + ch);
return MARC8; return MARC8;
} }
} }

View file

@ -126,7 +126,7 @@ public enum EncodingLevel {
case 'z': case 'z':
return NOT_APPLICABLE; return NOT_APPLICABLE;
default: default:
logger.log(Level.FINEST, "unknown encoding level " + ch); logger.log(Level.FINEST, () -> "unknown encoding level " + ch);
return FULL; return FULL;
} }
} }

View file

@ -71,7 +71,7 @@ public enum MultipartResourceRecordLevel {
case 'c': case 'c':
return PART_WITH_DEPENDENT_TITLE; return PART_WITH_DEPENDENT_TITLE;
default: default:
logger.log(Level.FINEST, "unknown multipart resource record level: " + ch); logger.log(Level.FINEST, () -> "unknown multipart resource record level: " + ch);
return NOT_SPECIFIED; return NOT_SPECIFIED;
} }
} }

View file

@ -82,7 +82,7 @@ public enum RecordStatus {
case 'p': case 'p':
return INCREASE_IN_ENCODING_LEVEL_FROM_PREPUBLICATION; return INCREASE_IN_ENCODING_LEVEL_FROM_PREPUBLICATION;
default: default:
logger.log(Level.FINEST, "unknown record status: " + ch); logger.log(Level.FINEST, () -> "unknown record status: " + ch);
return UNKNOWN; return UNKNOWN;
} }
} }

View file

@ -55,7 +55,7 @@ public enum TypeOfControl {
case 'a' : case 'a' :
return ARCHIVAL; return ARCHIVAL;
default: default:
logger.log(Level.FINEST, "unknown type of control: " + ch); logger.log(Level.FINEST, () -> "unknown type of control: " + ch);
return UNSPECIFIED; return UNSPECIFIED;
} }
} }

View file

@ -200,7 +200,7 @@ public enum TypeOfRecord {
case 't': case 't':
return LANGUAGE_MATERIAL_MANUSCRIPT_MARC21; return LANGUAGE_MATERIAL_MANUSCRIPT_MARC21;
default: default:
logger.log(Level.FINEST, "unknown type of record: " + ch); logger.log(Level.FINEST, () -> "unknown type of record: " + ch);
return UNSPECIFIED; return UNSPECIFIED;
} }
} }

View file

@ -225,7 +225,7 @@ public class MarcFieldTransformer extends LinkedHashMap<String, MarcField> {
if (m.find()) { if (m.find()) {
if (repeatCounter > 99) { if (repeatCounter > 99) {
repeatCounter = 99; repeatCounter = 99;
logger.log(Level.WARNING, "counter > 99, overflow in %s", marcField); logger.log(Level.WARNING, () -> "counter > 99, overflow in " + marcField);
} }
return m.replaceAll(String.format("%02d", repeatCounter)); return m.replaceAll(String.format("%02d", repeatCounter));
} }
@ -360,7 +360,6 @@ public class MarcFieldTransformer extends LinkedHashMap<String, MarcField> {
* @param map a map of mappable tags * @param map a map of mappable tags
* @return a MARC field tranformer * @return a MARC field tranformer
*/ */
@SuppressWarnings("unchecked")
public Builder from(Map<String, String> map) { public Builder from(Map<String, String> map) {
for (Map.Entry<String, String> entry : map.entrySet()) { for (Map.Entry<String, String> entry : map.entrySet()) {
fromTo(entry.getKey(), entry.getValue()); fromTo(entry.getKey(), entry.getValue());