Class NullDataSource
- java.lang.Object
-
- org.jetbrains.mps.openapi.persistence.NullDataSource
-
- All Implemented Interfaces:
DataSource
public final class NullDataSource extends Object implements DataSource
An empty implementation of the DataSource interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NullDataSource.NullDataSourceType
-
Constructor Summary
Constructors Constructor Description NullDataSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(DataSourceListener listener)
Registers listeners which need to be notified about changes in the underlying data source.String
getLocation()
Yields a string representation for the location of the data source (if applicable)long
getTimestamp()
Retrieves the last modification timestamp.DataSourceType
getType()
Defines a data source type for this kind of data sources.boolean
isReadOnly()
Sometimes there is a possibility to editDataSource
, though it is not available on this level.void
removeListener(DataSourceListener listener)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jetbrains.mps.openapi.persistence.DataSource
isAlive, refresh
-
-
-
-
Method Detail
-
getLocation
@NotNull public String getLocation()
Description copied from interface:DataSource
Yields a string representation for the location of the data source (if applicable)- Specified by:
getLocation
in interfaceDataSource
-
addListener
public void addListener(@NotNull DataSourceListener listener)
Description copied from interface:DataSource
Registers listeners which need to be notified about changes in the underlying data source. It is the responsibility of the DataSource to detect such updates and notify the listeners. if- Specified by:
addListener
in interfaceDataSource
-
removeListener
public void removeListener(@NotNull DataSourceListener listener)
- Specified by:
removeListener
in interfaceDataSource
-
getTimestamp
public long getTimestamp()
Description copied from interface:DataSource
Retrieves the last modification timestamp. The timestamp should reliably reflect all external changes to the data source. fixme what a great idea to encode things in the timestamp, why not read-only property is denoted by -2?- Specified by:
getTimestamp
in interfaceDataSource
- Returns:
- 0 if timestamp is not supported for the source, or -1 if the source is dead (like when file is deleted)
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:DataSource
Sometimes there is a possibility to editDataSource
, though it is not available on this level. For examples please seeStreamDataSource
,MultiStreamDataSource
.- Specified by:
isReadOnly
in interfaceDataSource
- Returns:
- whether this data source can be changed. fixme not clear: change from api like #openOutputStream or changed externally?
-
getType
@NotNull public DataSourceType getType()
Description copied from interface:DataSource
Defines a data source type for this kind of data sources. The data source type notion is strongly associated with the possibility to provideDataSourceFactory
andModelFactory
custom mappings. SeeDataSourceFactoryRuleService
andModelFactoryService
for the implementation details.- Specified by:
getType
in interfaceDataSource
- Returns:
- the unique data source type for this instance of data source if the developer wants others to be able to change the default behavior of this data source (register with the same key) or if he desires to associate this data source with some specific model factory.
-
-