|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.marc4j.marc.Record
Record
defines behaviour for a record.
The structure of a record according to the MARC standard is as follows:
LEADER DIRECTORY FT CONTROL_NUMBER_FIELD FT CONTROL_FIELD_1 FT ... CONTROL_FIELD_n FT DATA_FIELD_1 FT ... DATA_FIELD_n FT RT
This structure is returned by the marshal()
method.
Note: the control number field (tag 001) is an instance
of a ControlField
. The method add(ControlField field)
throws an IllegalAddException
when more than one
control number field is supplied.
Constructor Summary | |
Record()
Default constructor. |
|
Record(Leader leader)
Creates a new instance for a record and registers the leader. |
Method Summary | |
void |
add(ControlField field)
Adds a new ControlField instance to
the collection of variable fields. |
void |
add(DataField field)
Adds a new DataField instance to
the collection of variable fields. |
void |
add(Leader leader)
Registers the leader. |
ControlField |
getControlField(String tag)
Returns the control field for the given tag. |
List |
getControlFieldList()
Returns the collection of control fields. |
String |
getControlNumber()
Returns the control number (contents for tag 001). |
ControlField |
getControlNumberField()
Returns the control number field (tag 001). |
DataField |
getDataField(String tag)
Returns the data field for the given tag. |
List |
getDataFieldList()
Returns the collection of data fields. |
Leader |
getLeader()
Returns the leader. |
List |
getVariableFieldList()
Returns the collection of variable fields. |
boolean |
hasControlNumberField()
Returns true if the collection of variable fields contains a control number field. |
boolean |
hasVariableField(String tag)
Returns true if there is a variable field with the given tag. |
String |
marshal()
Returns a String representation for a record
following the structure of a MARC record (tape format). |
void |
setControlFieldList(List newList)
Sets the collection of control fields. |
void |
setDataFieldList(List newList)
Sets the collection of data fields. |
void |
setVariableFieldList(List newList)
Sets the collection of variable fields. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Record()
Default constructor.
public Record(Leader leader)
Creates a new instance for a record and registers the leader.
leader
- the Leader
objectMethod Detail |
public Leader getLeader()
Returns the leader.
Leader
- the leaderpublic void add(Leader leader)
Registers the leader.
leader
- the Leader
objectpublic void add(ControlField field)
Adds a new ControlField
instance to
the collection of variable fields.
Checks if the variable field is a control number field (tag 001).
If the field is a control number field an
IllegalAddException
is thrown when there is already
a control number field in the field collection.
field
- the control field
IllegalAddException
- when there is already a control
number field on the field mappublic void add(DataField field)
Adds a new DataField
instance to
the collection of variable fields.
field
- the data fieldpublic ControlField getControlNumberField()
Returns the control number field (tag 001).
ControlField
- the control number fieldpublic String getControlNumber()
Returns the control number (contents for tag 001).
public ControlField getControlField(String tag)
Returns the control field for the given tag.
tag
- the tag name
public boolean hasVariableField(String tag)
Returns true if there is a variable field with the given tag.
tag
- the tag name
public DataField getDataField(String tag)
Returns the data field for the given tag.
tag
- the tag name
public boolean hasControlNumberField()
Returns true if the collection of variable fields contains a control number field.
boolean
- true if there is a control number
field, false if there is no control
number fieldpublic List getControlFieldList()
Returns the collection of control fields.
The collection of control fields contains:
List
- the control field collectionControlField
public void setControlFieldList(List newList)
Sets the collection of control fields.
A collection of control fields is a List
object
with null or more ControlField
objects.
Note: this method replaces the current List
of control fields with the control fields in the new List
.
newList
- the new control field collectionpublic List getDataFieldList()
Returns the collection of data fields.
List
- the data field collectionDataField
public void setDataFieldList(List newList)
Sets the collection of data fields.
A collection of data fields is a List
object
with null or more DataField
objects.
Note: this method replaces the current List
of data fields with the data fields in the new List
.
newList
- the new data field collectionpublic List getVariableFieldList()
Returns the collection of variable fields.
The collection of variable fields contains:
List
- the variable field collectionControlField
,
DataField
public void setVariableFieldList(List newList)
Sets the collection of variable fields.
A collection of variable fields is a List
object
with null or more ControlField
or DataField
objects.
Note: this method replaces the current List
of variable fields with the variable fields in the new List
.
newList
- the new variable field collectionpublic String marshal() throws MarcException
Returns a String
representation for a record
following the structure of a MARC record (tape format).
Variable fields are sorted by tag name.
String
- the MARC record
MarcException
- if the record contains no leader or no
control number field
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |