Package org.dizitart.no2.migration
Interface RepositoryInstruction
-
public interface RepositoryInstructionRepresents a migration instruction set forObjectRepository.- Since:
- 4.0
- Author:
- Anindya Chatterjee
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T> RepositoryInstructionaddField(String fieldName)Adds an instruction to add new field to the entity in theObjectRepository.default <T> RepositoryInstructionaddField(String fieldName, Generator<T> generator)Adds an instruction to add new field with value generator, into the entity in theObjectRepository.default <T> RepositoryInstructionaddField(String fieldName, T defaultValue)Adds an instruction to add new field with a default value, into the entity in theObjectRepository.voidaddStep(MigrationStep step)Adds a migration step to the instruction set.default RepositoryInstructionchangeDataType(String fieldName, TypeConverter<?,?> converter)Adds an instruction to change the datatype of a field of the entity in theObjectRepository.default RepositoryInstructionchangeIdField(List<String> oldFieldNames, List<String> newFieldNames)Adds an instruction to change the id field of an entity in theObjectRepositorydefault RepositoryInstructionchangeIdField(Fields oldField, Fields newField)Adds an instruction to change the id field of an entity in theObjectRepositorydefault RepositoryInstructioncreateIndex(String indexType, String... fieldNames)Adds an instruction to create an index in theObjectRepository.default RepositoryInstructiondeleteField(String fieldName)Adds an instruction to delete a field from the entity in theObjectRepository.default RepositoryInstructiondropAllIndices()Adds an instruction to drop all indices from theObjectRepository.default RepositoryInstructiondropIndex(String... fieldNames)Adds an instruction to drop an index from theObjectRepository.StringentityName()The entity name of theObjectRepository.Stringkey()The key of theObjectRepository.default RepositoryInstructionrenameField(String oldName, String newName)Adds an instruction to rename a field to the entity in theObjectRepository.default RepositoryInstructionrenameRepository(String entityName, String key)Adds an instruction to rename theObjectRepository.
-
-
-
Method Detail
-
renameRepository
default RepositoryInstruction renameRepository(String entityName, String key)
Adds an instruction to rename theObjectRepository.- Parameters:
entityName- the entity namekey- the key- Returns:
- the repository instruction
-
addField
default <T> RepositoryInstruction addField(String fieldName)
Adds an instruction to add new field to the entity in theObjectRepository.- Type Parameters:
T- the type parameter- Parameters:
fieldName- the field name- Returns:
- the repository instruction
-
addField
default <T> RepositoryInstruction addField(String fieldName, T defaultValue)
Adds an instruction to add new field with a default value, into the entity in theObjectRepository.- Type Parameters:
T- the type parameter- Parameters:
fieldName- the field namedefaultValue- the default value- Returns:
- the repository instruction
-
addField
default <T> RepositoryInstruction addField(String fieldName, Generator<T> generator)
Adds an instruction to add new field with value generator, into the entity in theObjectRepository.- Type Parameters:
T- the type parameter- Parameters:
fieldName- the field namegenerator- the generator- Returns:
- the repository instruction
-
renameField
default RepositoryInstruction renameField(String oldName, String newName)
Adds an instruction to rename a field to the entity in theObjectRepository.- Parameters:
oldName- the old namenewName- the new name- Returns:
- the repository instruction
-
deleteField
default RepositoryInstruction deleteField(String fieldName)
Adds an instruction to delete a field from the entity in theObjectRepository.- Parameters:
fieldName- the field name- Returns:
- the repository instruction
-
changeDataType
default RepositoryInstruction changeDataType(String fieldName, TypeConverter<?,?> converter)
Adds an instruction to change the datatype of a field of the entity in theObjectRepository.- Parameters:
fieldName- the field nameconverter- the converter- Returns:
- the repository instruction
-
changeIdField
default RepositoryInstruction changeIdField(List<String> oldFieldNames, List<String> newFieldNames)
Adds an instruction to change the id field of an entity in theObjectRepository- Parameters:
oldFieldNames- the old field namesnewFieldNames- the new field names- Returns:
- the repository instruction
-
changeIdField
default RepositoryInstruction changeIdField(Fields oldField, Fields newField)
Adds an instruction to change the id field of an entity in theObjectRepository- Parameters:
oldField- the old field namesnewField- the new field names- Returns:
- the repository instruction
-
dropIndex
default RepositoryInstruction dropIndex(String... fieldNames)
Adds an instruction to drop an index from theObjectRepository.- Parameters:
fieldNames- the field names- Returns:
- the repository instruction
-
dropAllIndices
default RepositoryInstruction dropAllIndices()
Adds an instruction to drop all indices from theObjectRepository.- Returns:
- the repository instruction
-
createIndex
default RepositoryInstruction createIndex(String indexType, String... fieldNames)
Adds an instruction to create an index in theObjectRepository.- Parameters:
indexType- the index typefieldNames- the field names- Returns:
- the repository instruction
-
entityName
String entityName()
The entity name of theObjectRepository.- Returns:
- the string
-
key
String key()
The key of theObjectRepository.- Returns:
- the string
-
addStep
void addStep(MigrationStep step)
Adds a migration step to the instruction set.- Parameters:
step- the step
-
-