Verified Owner
Top Description Fields Constructors Methods
org.jabref.model.entry

public Class Author

extends Object
Class Inheritance
Annotations
@AllowedToUseLogic:because it needs to use formatter
Imports
java.util.Objects, .Optional, org.jabref.architecture.AllowedToUseLogic, org.jabref.logic.formatter.bibtexfields.RemoveWordEnclosingAndOuterEnclosingBracesFormatter, org.jabref.logic.util.strings.StringUtil, org.jabref.model.strings.LatexToUnicodeAdapter

This is an immutable class that keeps information regarding single author. It is just a container for the information, with very simple methods to access it.

Current usage: only methods getLastOnly, getFirstLast, and getLastFirst are used; all other methods are provided for completeness.

Field Summary

Modifier and TypeField and Description
private final String
public static final RemoveWordEnclosingAndOuterEnclosingBracesFormatter
private final String
private final String
private Author
private final String
private final String
public static final Author
OTHERS

Object indicating the others author.

Constructor Summary

AccessConstructor and Description
public
Author(String
the first name of the author (may consist of several tokens, like "Charles Louis Xavier Joseph" in "Charles Louis Xavier Joseph de la Vall{'e}e Poussin")
givenName
,
String
the abbreviated first name of the author (may consist of several tokens, like "C. L. X. J." in "Charles Louis Xavier Joseph de la Vall{'e}e Poussin"). It is a responsibility of the caller to create a reasonable abbreviation of the first name.
givenNameAbbreviated
,
String
the von part of the author's name (may consist of several tokens, like "de la" in "Charles Louis Xavier Joseph de la Vall{'e}e Poussin")
namePrefix
,
String
the last name of the author (may consist of several tokens, like "Vall{'e}e Poussin" in "Charles Louis Xavier Joseph de la Vall{'e}e Poussin")
familyName
,
String
the junior part of the author's name (may consist of several tokens, like "Jr. III" in "Smith, Jr. III, John")
nameSuffix
)

Creates the Author object.

Method Summary

Modifier and TypeMethod and Description
public static String
public boolean

Returns:

true iff the other object is an Author and all fields are Objects.equals.
equals
(Object other)

Overrides java.lang.Object.equals.

Compare this object with the given one.

public String

Returns:

'von Last, Jr., First' (if abbr==false) or 'von Last, Jr., F.' (if abbr==true)
getFamilyGiven
(boolean
true - abbreviate first name, false - do not abbreviate
abbr
)

Returns the author's name in form 'von Last, Jr., First' with the first name full or abbreviated depending on parameter.

public Optional<String>

Returns:

last name of the author (may consist of several tokens)
getFamilyName
()

Returns the last name of the author stored in this object ("Last").

public String

Returns:

'First von Last, Jr.' (if abbr==false) or 'F. von Last, Jr.' (if abbr==true)
getGivenFamily
(boolean
true - abbreviate first name, false - do not abbreviate
abbr
)

Returns the author's name in form 'First von Last, Jr.' with the first name full or abbreviated depending on parameter.

public Optional<String>

Returns:

first name of the author (may consist of several tokens)
getGivenName
()

Returns the first name of the author stored in this object ("First").

public Optional<String>

Returns:

abbreviated first name of the author (may consist of several tokens)
getGivenNameAbbreviated
()

Returns the abbreviated first name of the author stored in this object ("F.").

public String

Returns:

"Last, Jr, F." as described above or "" if all these parts are empty.
getNameForAlphabetization
()

Returns the name as "Last, Jr, F." omitting the von-part and removing starting braces.

public Optional<String>

Returns:

von part of the author's name (may consist of several tokens)
getNamePrefix
()

Returns the von part of the author's name stored in this object ("von", "name prefix").

public String

Returns:

'von Last'
getNamePrefixAndFamilyName
()

Returns von-part followed by last name ("von Last").

public Optional<String>

Returns:

junior part of the author's name (may consist of several tokens) or null if the author does not have a Jr. Part
getNameSuffix
()

Returns the name suffix ("junior") part of the author's name stored in this object ("Jr").

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public Author
latexFree()

Returns a LaTeX-free version of this Author.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

familyNameback to summary
private final String familyName
FORMATTERback to summary
public static final RemoveWordEnclosingAndOuterEnclosingBracesFormatter FORMATTER
givenNameback to summary
private final String givenName
givenNameAbbreviatedback to summary
private final String givenNameAbbreviated
latexFreeAuthorback to summary
private Author latexFreeAuthor
namePrefixback to summary
private final String namePrefix
nameSuffixback to summary
private final String nameSuffix
OTHERSback to summary
public static final Author OTHERS

Object indicating the others author. This is a BibTeX feature mostly rendered in "et al." in LaTeX. Example: authors = {Oliver Kopp and others}. This is then appearing as "Oliver Kopp et al.". In the context of BibTeX key generation, this is "Kopp+" (+ for "et al.") and not "KO".

Constructor Detail

Authorback to summary
public Author(String givenName, String givenNameAbbreviated, String namePrefix, String familyName, String nameSuffix)

Creates the Author object. If any part of the name is absent, null must be passed; otherwise other methods may return erroneous results.

In case only the last part is passed, enclosing braces are

Parameters
givenName:String

the first name of the author (may consist of several tokens, like "Charles Louis Xavier Joseph" in "Charles Louis Xavier Joseph de la Vall{'e}e Poussin")

givenNameAbbreviated:String

the abbreviated first name of the author (may consist of several tokens, like "C. L. X. J." in "Charles Louis Xavier Joseph de la Vall{'e}e Poussin"). It is a responsibility of the caller to create a reasonable abbreviation of the first name.

namePrefix:String

the von part of the author's name (may consist of several tokens, like "de la" in "Charles Louis Xavier Joseph de la Vall{'e}e Poussin")

familyName:String

the last name of the author (may consist of several tokens, like "Vall{'e}e Poussin" in "Charles Louis Xavier Joseph de la Vall{'e}e Poussin")

nameSuffix:String

the junior part of the author's name (may consist of several tokens, like "Jr. III" in "Smith, Jr. III, John")

Method Detail

addDotIfAbbreviationback to summary
public static String addDotIfAbbreviation(String name)
equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Compare this object with the given one.

Returns:boolean

true iff the other object is an Author and all fields are Objects.equals.

Annotations
@Override
getFamilyGivenback to summary
public String getFamilyGiven(boolean abbr)

Returns the author's name in form 'von Last, Jr., First' with the first name full or abbreviated depending on parameter.

Parameters
abbr:boolean

true - abbreviate first name, false - do not abbreviate

Returns:String

'von Last, Jr., First' (if abbr==false) or 'von Last, Jr., F.' (if abbr==true)

getFamilyNameback to summary
public Optional<String> getFamilyName()

Returns the last name of the author stored in this object ("Last").

Returns:Optional<String>

last name of the author (may consist of several tokens)

getGivenFamilyback to summary
public String getGivenFamily(boolean abbr)

Returns the author's name in form 'First von Last, Jr.' with the first name full or abbreviated depending on parameter.

Parameters
abbr:boolean

true - abbreviate first name, false - do not abbreviate

Returns:String

'First von Last, Jr.' (if abbr==false) or 'F. von Last, Jr.' (if abbr==true)

getGivenNameback to summary
public Optional<String> getGivenName()

Returns the first name of the author stored in this object ("First").

Returns:Optional<String>

first name of the author (may consist of several tokens)

getGivenNameAbbreviatedback to summary
public Optional<String> getGivenNameAbbreviated()

Returns the abbreviated first name of the author stored in this object ("F.").

Returns:Optional<String>

abbreviated first name of the author (may consist of several tokens)

getNameForAlphabetizationback to summary
public String getNameForAlphabetization()

Returns the name as "Last, Jr, F." omitting the von-part and removing starting braces.

Returns:String

"Last, Jr, F." as described above or "" if all these parts are empty.

getNamePrefixback to summary
public Optional<String> getNamePrefix()

Returns the von part of the author's name stored in this object ("von", "name prefix").

Returns:Optional<String>

von part of the author's name (may consist of several tokens)

getNamePrefixAndFamilyNameback to summary
public String getNamePrefixAndFamilyName()

Returns von-part followed by last name ("von Last"). If both fields were specified as null, the empty string "" is returned.

Returns:String

'von Last'

getNameSuffixback to summary
public Optional<String> getNameSuffix()

Returns the name suffix ("junior") part of the author's name stored in this object ("Jr").

Returns:Optional<String>

junior part of the author's name (may consist of several tokens) or null if the author does not have a Jr. Part

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
latexFreeback to summary
public Author latexFree()

Returns a LaTeX-free version of this Author.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override