|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.marc4j.marc.VariableField
org.marc4j.marc.DataField
DataField
defines behaviour for a data field
(tag 010-999).
Data fields are variable fields identified by tags beginning with ASCII numeric values other than two zero's. Data fields contain indicators, subfield codes, data and a field terminator. The structure of a data field according to the MARC standard is as follows:
INDICATOR_1 INDICATOR_2 DELIMITER DATA_ELEMENT_IDENTIFIER_1 DATA_ELEMENT_1 ... DELIMITER DATA_ELEMENT_IDENTIFIER_n DATA_ELEMENT_n FT
This structure is returned by the marshal()
method.
Field Summary |
Fields inherited from class org.marc4j.marc.VariableField |
FT |
Constructor Summary | |
DataField()
Default constructor. |
|
DataField(String tag)
Creates a new DataField instance and
registers the tag name. |
|
DataField(String tag,
char ind1,
char ind2)
Creates a new DataField instance and
registers the tag name and the indicator values. |
Method Summary | |
void |
add(Subfield subfield)
Adds a new subfield instance to
the collection of data elements. |
char |
getIndicator1()
Returns the first indicator. |
char |
getIndicator2()
Returns the second indicator. |
int |
getLength()
Returns the length of the serialized form of the current data field. |
Subfield |
getSubfield(char code)
Returns the subfield for a given data element identifier. |
List |
getSubfieldList()
Returns the collection of data elements. |
String |
getTag()
Returns the tag name. |
boolean |
hasSubfield(char code)
Returns true if there is a subfield with the given identifier. |
String |
marshal()
Returns a String representation for a data field
following the structure of a MARC data field. |
void |
setIndicator1(char ind1)
Registers the first indicator value. |
void |
setIndicator2(char ind2)
Registers the second indicator value. |
void |
setSubfieldList(List newList)
Sets the collection of data elements. |
void |
setTag(String tag)
Registers the tag. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DataField()
Default constructor.
public DataField(String tag)
Creates a new DataField
instance and
registers the tag name.
tag
- the tag namepublic DataField(String tag, char ind1, char ind2)
Creates a new DataField
instance and
registers the tag name and the indicator values.
tag
- the tag nameind1
- the first indicatorind2
- the second indicatorMethod Detail |
public void setTag(String tag)
Registers the tag.
setTag
in class VariableField
tag
- the tag name
IllegalTagException
- when the tag is not a valid
data field identifierpublic String getTag()
Returns the tag name.
getTag
in class VariableField
String
- the tag namepublic void setIndicator1(char ind1)
Registers the first indicator value.
ind1
- the first indicator
IllegalIndicatorException
- when the indicator value is invalidpublic void setIndicator2(char ind2)
Registers the second indicator value.
ind2
- the second indicator
IllegalIndicatorException
- when the indicator value is invalidpublic void add(Subfield subfield)
Adds a new subfield
instance to
the collection of data elements.
subfield
- the data elementSubfield
public char getIndicator1()
Returns the first indicator.
char
- the first indicatorpublic char getIndicator2()
Returns the second indicator.
char
- the second indicatorpublic List getSubfieldList()
Returns the collection of data elements.
List
- the data element collectionSubfield
public Subfield getSubfield(char code)
Returns the subfield for a given data element identifier.
code
- the data element identifier
Subfield
public boolean hasSubfield(char code)
Returns true if there is a subfield with the given identifier.
code
- the data element identifier
public void setSubfieldList(List newList)
Sets the collection of data elements.
A collection of data elements is a List
object
with null or more Subfield
objects.
Note: this method replaces the current List
of subfields with the subfields in the new List
.
newList
- the new data element collectionpublic String marshal()
Returns a String
representation for a data field
following the structure of a MARC data field.
String
- the data fieldpublic int getLength()
Returns the length of the serialized form of the current data field.
int
- the data field length
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |