Class VariableField

  • All Implemented Interfaces:
    Serializable, Cloneable
    Direct Known Subclasses:
    ControlField, DataField

    public abstract class VariableField
    extends Object
    implements Serializable, Cloneable

    VariableField defines general behaviour for variable fields.

    According to the MARC standard the variable fields follow the leader and the directory in the record and consist of control fields and data fields. Control fields precede data fields in the record and are arranged in the same sequence as the corresponding entries in the directory.

    Author:
    Bas Peters
    See Also:
    ControlField, DataField, Serialized Form
    • Field Detail

      • EMPTY_ID

        public static final Long EMPTY_ID
        Empty value for the field id
    • Constructor Detail

      • VariableField

        protected VariableField()

        Default constructor.

      • VariableField

        protected VariableField​(String tag)

        Creates a new VariableField for the supplied tag.

        Parameters:
        tag - the tag name
      • VariableField

        protected VariableField​(VariableField other)
        Copy constructor. Copy id attribute, so if you don't want has the same, use setId(VariableField.EMPTY_ID) with the new created instance.
        Parameters:
        other - another Variablefield where copy the values
    • Method Detail

      • setTag

        public void setTag​(String tag)

        Registers the tag name.

        Parameters:
        tag - the tag name
      • getTag

        public String getTag()

        Returns the tag name.

        Returns:
        String - the tag name
      • getId

        public Long getId()
        Returns:
        Returns the id field value.
      • setId

        public void setId​(Long id)
        Parameters:
        id - The new id value.
      • find

        public abstract boolean find​(Pattern pattern)
        Returns true is the supplied regular expression pattern matches the Variablefield data; else, false.
        Parameters:
        regex - A regular expression pattern to find in the subfields
      • equals

        public abstract boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • hashCode

        public abstract int hashCode()
        Overrides:
        hashCode in class Object