# Class AbstractSAMHeaderRecord

java.lang.Object
htsjdk.samtools.AbstractSAMHeaderRecord

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `SAMFileHeader, SAMProgramRecord, SAMReadGroupRecord, SAMSequenceRecord`

public abstract class AbstractSAMHeaderRecord extends Object implements Serializable
Base class for the various concrete records in a SAM header, providing uniform access to the attributes.

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final long`
`serialVersionUID`

## Constructor Summary

Constructors
Constructor
Description
`AbstractSAMHeaderRecord()`

## Method Summary

Modifier and Type
Method
Description
`protected boolean`
`attributesEqual(AbstractSAMHeaderRecord that)`
For use in the equals() method of the concrete class.
`protected int`
`attributesHashCode()`
For use in the hashCode() method of the concrete class.
`String`
`getAttribute(String key)`
`Set<Map.Entry<String,String>>`
`getAttributes()`
Returns the Set of attributes.
`String`
`getId()`
Returns the ID tag (or equivalent) for this header record.
`abstract String`
`getSAMString()`
Returns the record in the SAM line-based text format.
`void`
`setAttribute(SAMTag tag, String value)`
Set the given value for the SAMTag 'tag'.
`void`
`setAttribute(String key, Object value)`
Deprecated.
Use `setAttribute(String, String)` instead
`void`
`setAttribute(String key, String value)`
Set the given value for the attribute named 'key'.
`String`
`toString()`
Simple to String that outputs the concrete class name and the set of attributes stored.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### serialVersionUID

public static final long serialVersionUID

See Also:
  - Constant Field Values

## Constructor Details

### AbstractSAMHeaderRecord

public AbstractSAMHeaderRecord()

## Method Details

### getAttribute

public String getAttribute(String key)

### setAttribute

@Deprecated public void setAttribute(String key, Object value)
Deprecated.
Use `setAttribute(String, String)` instead
Set the given value for the attribute named 'key'. Replaces an existing value, if any. If value is null, the attribute is removed. Otherwise, the value will be converted to a String with toString.

Parameters:
  `key` - attribute name
  `value` - attribute value

### setAttribute

public void setAttribute(SAMTag tag, String value)
Set the given value for the SAMTag 'tag'. Replaces an existing value, if any. If value is null, the attribute is removed.

Parameters:
  `tag` - attribute name
  `value` - attribute value

### setAttribute

public void setAttribute(String key, String value)
Set the given value for the attribute named 'key'. Replaces an existing value, if any. If value is null, the attribute is removed.

Parameters:
  `key` - attribute name
  `value` - attribute value

### getAttributes

public Set<Map.Entry<String,String>> getAttributes()
Returns the Set of attributes.

### getId

public String getId()
Returns the ID tag (or equivalent) for this header record. The default implementation throws a SAMException to indicate "not implemented".

### attributesEqual

protected boolean attributesEqual(AbstractSAMHeaderRecord that)
For use in the equals() method of the concrete class.

### attributesHashCode

protected int attributesHashCode()
For use in the hashCode() method of the concrete class.

### toString

public String toString()
Simple to String that outputs the concrete class name and the set of attributes stored.

Overrides:
  `toString` in class `Object`

### getSAMString

public abstract String getSAMString()
Returns the record in the SAM line-based text format. Fields are separated by '\t' characters. The String is NOT terminated by '\n'.