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

public Class MetaDataParser

extends Object
Class Inheritance
Imports
java.io.IOException, .Reader, java.nio.file.InvalidPathException, .Path, java.util.ArrayList, .Comparator, .HashMap, .List, .Map, .Optional, java.util.regex.Pattern, org.jabref.logic.citationkeypattern.CitationKeyPattern, org.jabref.logic.cleanup.FieldFormatterCleanup, .FieldFormatterCleanupActions, .FieldFormatterCleanupMapper, org.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter, .NormalizeMonthFormatter, .NormalizePagesFormatter, org.jabref.logic.importer.ParseException, org.jabref.logic.journals.AbbreviationType, org.jabref.logic.layout.format.ReplaceUnicodeLigaturesFormatter, org.jabref.logic.util.Version, org.jabref.logic.util.strings.StringUtil, org.jabref.model.database.BibDatabaseMode, org.jabref.model.entry.BibEntryType, .BibEntryTypeBuilder, org.jabref.model.entry.field.FieldFactory, .InternalField, .StandardField, org.jabref.model.entry.types.EntryType, .EntryTypeFactory, org.jabref.model.metadata.ContentSelectors, .MetaData, .SaveOrder, 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
public static final List<FieldFormatterCleanup>
private static FileUpdateMonitor
private static final Logger
private static final Pattern

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static FieldFormatterCleanupActions
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>>
private void
handleBlgFilePathEntry(Map.Entry<String, String>
the metadata entry containing the user-specific .blg path.
entry
,
MetaData
the MetaData object to update.
metaData
)

Handles a blgFilePath-* metadata entry.

public MetaData
parse(Map<String, String> data, Character keywordSeparator, String userAndHost)

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, String userAndHost)

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

DEFAULT_SAVE_ACTIONSback to summary
public static final List<FieldFormatterCleanup> DEFAULT_SAVE_ACTIONS
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

fieldFormatterCleanupsParseback to summary
public static FieldFormatterCleanupActions fieldFormatterCleanupsParse(List<String> formatterMetaList)
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()
handleBlgFilePathEntryback to summary
private void handleBlgFilePathEntry(Map.Entry<String, String> entry, MetaData metaData)

Handles a blgFilePath-* metadata entry. Expects exactly one valid path.

Parameters
entry:Map.Entry<String, String>

the metadata entry containing the user-specific .blg path.

metaData:MetaData

the MetaData object to update.

parseback to summary
public MetaData parse(Map<String, String> data, Character keywordSeparator, String userAndHost) 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, String userAndHost) 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 library-specific 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)