org.marc4j.marc
Class Subfield

java.lang.Object
  |
  +--org.marc4j.marc.Subfield
All Implemented Interfaces:
Serializable

public class Subfield
extends Object
implements Serializable

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.

Version:
$Revision: 1.6 $
Author:
Bas Peters
See Also:
Serialized Form

Constructor Summary
Subfield()
          Default constructor
Subfield(char code, char[] data)
          Creates a new Subfield instance and registers the data element identifier and the data element.
Subfield(char code, String data)
          Creates a new Subfield instance and registers the data element identifier and the data element.
 
Method Summary
 char getCode()
          Returns the data element identifier.
 char[] getData()
          Returns the data element.
 String marshal()
          Returns a String representation for a data element following the structure of a MARC data element.
 void setCode(char code)
          Registers the data element identifier.
 void setData(char[] data)
          Registers the data element.
 void setData(String data)
          Registers the data element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 identifier
data - 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 identifier
data - the data element
Method Detail

setCode

public void setCode(char code)

Registers the data element identifier.

Parameters:
code - the data element identifier
Throws:
IllegalIdentifierException - when the data element identifier is not a valid data element identifier

setData

public void setData(char[] data)

Registers the data element.

Parameters:
data - the data element

setData

public void setData(String data)

Registers the data element.

Parameters:
data - the data element

getCode

public char getCode()

Returns the data element identifier.

Returns:
char - the data element identifier

getData

public char[] getData()

Returns the data element.

Returns:
char[] - the data element

marshal

public String marshal()

Returns a String representation for a data element following the structure of a MARC data element.

Returns:
String - the data element


Copyright 2001-2003 Bas Peters. All Rights Reserved.