Top Description Fields Constructors Methods
org.jabref.logic.layout.format

public Class IfPlural

extends AbstractParamLayoutFormatter
Class Inheritance
Imports
java.util.List, org.jabref.logic.layout.AbstractParamLayoutFormatter

This formatter takes two arguments and examines the field text. If the field text represents multiple individuals, that is it contains the string "and" then the field text is replaced with the first argument, otherwise it is replaced with the second. For example:

\format[IfPlural(Eds.,Ed.)]{\editor}

Should expand to 'Eds.' if the document has more than one editor and 'Ed.' if it only has one.

Field Summary

Modifier and TypeField and Description
private String
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
format(String
The text to layout.
fieldText
)

Implements org.jabref.logic.layout.LayoutFormatter.format.

Failure Mode:

Formatters should be robust in the sense that they always return some relevant string.

public void
setArgument(String
A String argument.
arg
)

Implements org.jabref.logic.layout.ParamLayoutFormatter.setArgument.

Method for setting the argument of this formatter.

Inherited from org.jabref.logic.layout.AbstractParamLayoutFormatter:
parseArgument

Field Detail

pluralTextback to summary
private String pluralText
singularTextback to summary
private String singularText

Constructor Detail

IfPluralback to summary
public IfPlural()

Method Detail

formatback to summary
public String format(String fieldText)

Implements org.jabref.logic.layout.LayoutFormatter.format.

Doc from org.jabref.logic.layout.LayoutFormatter.format.

Failure Mode:

Formatters should be robust in the sense that they always return some relevant string.

If the formatter can detect an invalid input it should return the original string otherwise it may simply return a wrong output.

Parameters
fieldText:String

The text to layout.

Returns:String

The layouted text.

Annotations
@Override
setArgumentback to summary
public void setArgument(String arg)

Implements org.jabref.logic.layout.ParamLayoutFormatter.setArgument.

Doc from org.jabref.logic.layout.ParamLayoutFormatter.setArgument.

Method for setting the argument of this formatter.

Parameters
arg:String

A String argument.

Annotations
@Override