com.github.drinkjava2.jdialects.id
Class AutoIdGenerator

java.lang.Object
  extended by com.github.drinkjava2.jdialects.id.AutoIdGenerator
All Implemented Interfaces:
IdGenerator

public class AutoIdGenerator
extends Object
implements IdGenerator

AutoGenerator will depends database's id generator mechanism like MySql's Identity, Oracle's Sequence...

Since:
1.0.0
Version:
1.0.0
Author:
Yong Zhu

Field Summary
static AutoIdGenerator INSTANCE
           
static SequenceIdGenerator SEQ_AUTOID_INSTANCE
           
static TableIdGenerator TABLE_AUTOID_INSTANCE
           
 
Constructor Summary
AutoIdGenerator()
           
 
Method Summary
 Boolean dependOnAutoIdGenerator()
          If depends on AutoIdGenerator, for example SortedUUIDGenerator depends on AutoIdGenerator to create start numbers
 GenerationType getGenerationType()
          Return GenerationType
 String getIdGenName()
          Return a unique Id Generator name in this TableModel
 Object getNextID(NormalJdbcTool jdbc, Dialect dialect, Type dataType)
          Get the next ID generated by implementation of IdGenerator
 IdGenerator getSequenceOrTableIdGenerator(Dialect dialect)
          If dialect support sequence, return a SequenceIdGenerator, otherwise return a TableIdGenerator
 IdGenerator newCopy()
          Return a newCopy (Deep Clone) instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final AutoIdGenerator INSTANCE

TABLE_AUTOID_INSTANCE

public static final TableIdGenerator TABLE_AUTOID_INSTANCE

SEQ_AUTOID_INSTANCE

public static final SequenceIdGenerator SEQ_AUTOID_INSTANCE
Constructor Detail

AutoIdGenerator

public AutoIdGenerator()
Method Detail

getGenerationType

public GenerationType getGenerationType()
Description copied from interface: IdGenerator
Return GenerationType

Specified by:
getGenerationType in interface IdGenerator

getIdGenName

public String getIdGenName()
Description copied from interface: IdGenerator
Return a unique Id Generator name in this TableModel

Specified by:
getIdGenName in interface IdGenerator

newCopy

public IdGenerator newCopy()
Description copied from interface: IdGenerator
Return a newCopy (Deep Clone) instance

Specified by:
newCopy in interface IdGenerator

dependOnAutoIdGenerator

public Boolean dependOnAutoIdGenerator()
Description copied from interface: IdGenerator
If depends on AutoIdGenerator, for example SortedUUIDGenerator depends on AutoIdGenerator to create start numbers

Specified by:
dependOnAutoIdGenerator in interface IdGenerator

getNextID

public Object getNextID(NormalJdbcTool jdbc,
                        Dialect dialect,
                        Type dataType)
Description copied from interface: IdGenerator
Get the next ID generated by implementation of IdGenerator

Specified by:
getNextID in interface IdGenerator
Parameters:
jdbc - A NormalJdbcTool implementation to access database
dialect - The Dialect
dataType - The Type of a column
Returns:
id generated by IdGenerator

getSequenceOrTableIdGenerator

public IdGenerator getSequenceOrTableIdGenerator(Dialect dialect)
If dialect support sequence, return a SequenceIdGenerator, otherwise return a TableIdGenerator



Copyright © 2018. All rights reserved.