Package org.marc4j.marc
Class Subfield
- java.lang.Object
-
- org.marc4j.marc.Subfield
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class Subfield extends Object implements Serializable, Cloneable
Subfield
defines behaviour for a subfield (a data element within a data field).A subfield consists of a delimiter followed by a data element identifier (together the subfield code) and a data element. The structure of a data element according to the MARC standard is as follows:
DELIMITER DATA_ELEMENT_IDENTIFIER DATA_ELEMENT
This structure is returned by the
marshal()
method.- Author:
- Bas Peters
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
EMPTY_LINK_CODE
Empty value for the link code
-
Constructor Summary
Constructors Constructor Description Subfield()
Default constructorSubfield(char code, char[] data)
Creates a newSubfield
instance and registers the data element identifier and the data element.Subfield(char code, char[] data, String linkCode)
Creates a newSubfield
instance and registers the data element identifier and the data element.Subfield(char code, String data)
Creates a newSubfield
instance and registers the data element identifier and the data element.Subfield(char code, String data, String linkCode)
Creates a newSubfield
instance and registers the data element identifier and the data element.Subfield(Subfield other)
Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Object
clone()
Deprecated.boolean
equals(Object obj)
boolean
find(Pattern pattern)
char
getCode()
Gets theSubfield
code.char[]
getData()
Gets theSubfield
data.String
getLinkCode()
Gets theSubfield
link code.int
hashCode()
String
marshal()
Returns aString
representation for a data element following the structure of a MARC data element.void
setCode(char code)
Sets theSubfield
code.void
setData(char[] data)
Sets theSubfield
data.void
setData(String data)
Sets theSubfield
data.void
setLinkCode(String linkCode)
Sets theSubfield
link code.String
toString()
-
-
-
Field Detail
-
EMPTY_LINK_CODE
public static final String EMPTY_LINK_CODE
Empty value for the link code
-
-
Constructor Detail
-
Subfield
public Subfield()
Default constructor
-
Subfield
public Subfield(char code, char[] data)
Creates a new
Subfield
instance and registers the data element identifier and the data element.- Parameters:
code
- the data element identifierdata
- the data element
-
Subfield
public Subfield(char code, String data)
Creates a new
Subfield
instance and registers the data element identifier and the data element.- Parameters:
code
- the data element identifierdata
- the data element
-
Subfield
public Subfield(char code, char[] data, String linkCode)
Creates a new
Subfield
instance and registers the data element identifier and the data element.- Parameters:
code
- the data element identifierdata
- the data elementlinkCode
- A code if the subfield has a link with another Record.
-
Subfield
public Subfield(char code, String data, String linkCode)
Creates a new
Subfield
instance and registers the data element identifier and the data element.- Parameters:
code
- the data element identifierdata
- the data elementlinkCode
- A code if the subfield has a link with another Record.
-
Subfield
public Subfield(Subfield other)
Copy constructor- Parameters:
other
- Another instance of Subfield
-
-
Method Detail
-
find
public boolean find(Pattern pattern)
- Parameters:
pattern
- An instance of a compiled Pattern to use as matcher
-
setCode
public void setCode(char code)
Sets theSubfield
code.- Parameters:
code
- The code identifier
-
getCode
public char getCode()
Gets theSubfield
code.- Returns:
char
The code identifier
-
setData
public void setData(char[] data)
Sets theSubfield
data.- Parameters:
data
- The data element
-
setData
public void setData(String data)
Sets theSubfield
data.- Parameters:
data
- The data element
-
getData
public char[] getData()
Gets theSubfield
data.- Returns:
char[]
The data element
-
marshal
public String marshal()
Returns aString
representation for a data element following the structure of a MARC data element.- Returns:
String
The marshaled representation of this Subfield
-
clone
@Deprecated public Object clone()
Deprecated.
-
-