Class TableNameMapImpl
- java.lang.Object
-
- com.healthmarketscience.jackcess.impl.NameMapImpl
-
- com.healthmarketscience.jackcess.impl.TableNameMapImpl
-
- All Implemented Interfaces:
NameMap,TableNameMap,Iterable<NameMap.Record>
public class TableNameMapImpl extends NameMapImpl implements TableNameMap
The name map of a table, which can be changed and saved back into the property of the table.- Author:
- James Ahlborn
- Usage:
- Advanced: This class is for advanced/internal use.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.healthmarketscience.jackcess.NameMap
NameMap.Mismatch, NameMap.MismatchType, NameMap.Record, NameMap.RecordType
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NameMap.RecordaddColumn(String name, String guid)Adds a column record before the end record.List<NameMap.Mismatch>findMismatches()Compares the table and column records with the table which holds this name map.NameMap.RecordgetColumnRecord(String name)List<NameMap.Record>getReferences()NameMap.RecordgetTableRecord()static TableNameMapImplread(byte[] bytes, TableImpl table)NameMap.RecordremoveColumn(String name)Removes the column record with the given name (case-insensitive).voidsave()Writes the name map into the table property and saves the properties of the table.-
Methods inherited from class com.healthmarketscience.jackcess.impl.NameMapImpl
getColumnRecords, getRecord, getTableRecords, getWriterTag, iterator, toBytes, toString
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface com.healthmarketscience.jackcess.NameMap
getColumnRecords, getRecord, getTableRecords, getWriterTag, stream
-
-
-
-
Method Detail
-
read
public static TableNameMapImpl read(byte[] bytes, TableImpl table) throws IOException
- Parameters:
bytes- the value of the name map property of a tabletable- the table which holds the property- Returns:
- the decoded name map
- Throws:
IOException- if the bytes are not a valid name map
-
getTableRecord
public NameMap.Record getTableRecord()
- Specified by:
getTableRecordin interfaceTableNameMap- Returns:
- the record for the table, or
nullif there is none
-
getColumnRecord
public NameMap.Record getColumnRecord(String name)
- Specified by:
getColumnRecordin interfaceTableNameMap- Returns:
- the column record with the given name (case-insensitive), or
nullif there is none
-
getReferences
public List<NameMap.Record> getReferences()
- Specified by:
getReferencesin interfaceTableNameMap- Returns:
- the records for the names which expressions in the table use, in the order of the name map
-
addColumn
public NameMap.Record addColumn(String name, String guid)
Description copied from interface:TableNameMapAdds a column record before the end record.- Specified by:
addColumnin interfaceTableNameMap- Parameters:
name- the column nameguid- the guid of the column, which must be the same as the "GUID" property of the column- Returns:
- the new record
-
removeColumn
public NameMap.Record removeColumn(String name)
Description copied from interface:TableNameMapRemoves the column record with the given name (case-insensitive).- Specified by:
removeColumnin interfaceTableNameMap- Returns:
- the removed record, or
nullif there is none
-
findMismatches
public List<NameMap.Mismatch> findMismatches() throws IOException
Description copied from interface:TableNameMapCompares the table and column records with the table which holds this name map. A column is found by its guid, and by its name when it has no guid or no record carries it.- Specified by:
findMismatchesin interfaceNameMap- Specified by:
findMismatchesin interfaceTableNameMap- Returns:
- every difference, empty if the name map agrees with the table
- Throws:
IOException
-
save
public void save() throws IOExceptionDescription copied from interface:TableNameMapWrites the name map into the table property and saves the properties of the table.- Specified by:
savein interfaceTableNameMap- Throws:
IOException
-
-