Top Description Fields Constructors Methods
org.jabref.logic.importer.util

public Class MetaDataParser

extends Object
Class Inheritance
Imports
java.io.IOException, .Reader, .StringReader, java.nio.file.Path, java.util.ArrayList, .Comparator, .HashMap, .List, .Map, .Optional, java.util.regex.Pattern, org.jabref.logic.citationkeypattern.CitationKeyPattern, org.jabref.logic.cleanup.FieldFormatterCleanups, org.jabref.logic.importer.ParseException, org.jabref.model.database.BibDatabaseMode, org.jabref.model.entry.BibEntryType, .BibEntryTypeBuilder, org.jabref.model.entry.field.FieldFactory, org.jabref.model.entry.types.EntryType, .EntryTypeFactory, org.jabref.model.metadata.ContentSelectors, .MetaData, .SaveOrder, org.jabref.model.strings.StringUtil, org.jabref.model.util.FileUpdateMonitor, org.slf4j.Logger, .LoggerFactory

Writing is done at org.jabref.logic.exporter.MetaDataSerializer.

Field Summary

Modifier and TypeField and Description
private static FileUpdateMonitor
private static final Logger
private static final Pattern

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static List<String>
private static Optional<String>
getNextUnit(Reader reader)

Reads the next unit.

private static String
getSingleItem(List<String> value)

Returns the first item in the list.

private static Comparator<? super Map.Entry<String, String>>
public MetaData
parse(Map<String, String> data, Character keywordSeparator)

Parses the given data map and returns a new resulting MetaData instance.

public MetaData

Returns:

the given metaData instance (which is modified, too)
parse
(MetaData metaData, Map<String, String> data, Character keywordSeparator)

Parses the data map and changes the given MetaData instance respectively.

public static Optional<BibEntryType>
pack-priv static String
parseDirectory(String
the raw value (as stored in the .bib file)
value
)

Parse the content of the value as provided by "raw" content.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fileMonitorback to summary
private static FileUpdateMonitor fileMonitor
LOGGERback to summary
private static final Logger LOGGER
SINGLE_BACKSLASHback to summary
private static final Pattern SINGLE_BACKSLASH

Constructor Detail

MetaDataParserback to summary
public MetaDataParser(FileUpdateMonitor fileMonitor)

Method Detail

getAsListback to summary
private static List<String> getAsList(String value) throws ParseException
getNextUnitback to summary
private static Optional<String> getNextUnit(Reader reader) throws IOException

Reads the next unit. Units are delimited by ';' (MetaData.SEPARATOR_CHARACTER).

getSingleItemback to summary
private static String getSingleItem(List<String> value) throws ParseException

Returns the first item in the list. If the specified list does not contain exactly one item, then a ParseException will be thrown.

groupsLastback to summary
private static Comparator<? super Map.Entry<String, String>> groupsLast()
parseback to summary
public MetaData parse(Map<String, String> data, Character keywordSeparator) throws ParseException

Parses the given data map and returns a new resulting MetaData instance.

parseback to summary
public MetaData parse(MetaData metaData, Map<String, String> data, Character keywordSeparator) throws ParseException

Parses the data map and changes the given MetaData instance respectively.

Returns:MetaData

the given metaData instance (which is modified, too)

parseCustomEntryTypeback to summary
public static Optional<BibEntryType> parseCustomEntryType(String comment)
parseDirectoryback to summary
pack-priv static String parseDirectory(String value)

Parse the content of the value as provided by "raw" content. We do not use unescaped value (created by @link{#getAsList(java.lang.String)}), because this leads to difficulties with UNC names. No normalization is done - the general file directory could be passed as Mac OS X path, but the user could sit on Windows.

Parameters
value:String

the raw value (as stored in the .bib file)