org.marc4j.marc.impl
Class SubfieldImpl

java.lang.Object
  extended by org.marc4j.marc.impl.SubfieldImpl
All Implemented Interfaces:
Serializable, Subfield

public class SubfieldImpl
extends Object
implements Subfield

Represents a subfield in a MARC record.

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

Constructor Summary
SubfieldImpl()
          Creates a new Subfield.
SubfieldImpl(char code)
          Creates a new Subfield and sets the data element identifier.
SubfieldImpl(char code, String data)
          Creates a new Subfield and sets the data element identifier and the data element.
 
Method Summary
 boolean find(String pattern)
          Returns true if the given regular expression matches a subsequence of the data element.
 char getCode()
          Returns the data element identifier.
 String getData()
          Returns the data element.
 Long getId()
          Returns the identifier.
 void setCode(char code)
          Sets the data element identifier.
 void setData(String data)
          Sets the data element.
 void setId(Long id)
          Sets the identifier.
 String toString()
          Returns a string representation of this subfield.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubfieldImpl

public SubfieldImpl()
Creates a new Subfield.


SubfieldImpl

public SubfieldImpl(char code)
Creates a new Subfield and sets the data element identifier.

Parameters:
code - the data element identifier

SubfieldImpl

public SubfieldImpl(char code,
                    String data)
Creates a new Subfield and sets 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)
Description copied from interface: Subfield
Sets the data element identifier.

Specified by:
setCode in interface Subfield
Parameters:
code - the data element identifier

getCode

public char getCode()
Description copied from interface: Subfield
Returns the data element identifier.

Specified by:
getCode in interface Subfield
Returns:
char - the data element identifier

setData

public void setData(String data)
Description copied from interface: Subfield
Sets the data element.

Specified by:
setData in interface Subfield
Parameters:
data - the data element

getData

public String getData()
Description copied from interface: Subfield
Returns the data element.

Specified by:
getData in interface Subfield
Returns:
String - the data element

find

public boolean find(String pattern)
Description copied from interface: Subfield
Returns true if the given regular expression matches a subsequence of the data element. See (@link java.util.regex.Pattern} for regular expressions.

Specified by:
find in interface Subfield
Parameters:
pattern - the regular expression
Returns:
true if the pattern matches, false othewise

toString

public String toString()
Returns a string representation of this subfield.

Example:

 $aSummerland /
 

Overrides:
toString in class Object
Returns:
String - a string representation of this subfield

setId

public void setId(Long id)
Description copied from interface: Subfield
Sets the identifier.

The purpose of this identifier is to provide an identifier for persistency.

Specified by:
setId in interface Subfield
Parameters:
id - the identifier

getId

public Long getId()
Description copied from interface: Subfield
Returns the identifier.

Specified by:
getId in interface Subfield
Returns:
Long - the identifier


Copyright © 2002-2006 Bas Peters. All Rights Reserved.