@@ -67,34 +67,42 @@ class RowBatcherImpl<T> extends BatcherImpl implements RowBatcher<T> {
6767 private final AtomicLong serverTimestamp = new AtomicLong (-1 );
6868
6969 private final ContentHandle <T > rowsHandle ;
70- private final Class <T > rowsClass ;
7170 private final RowManager defaultRowManager ;
7271
7372 RowBatcherImpl (DataMovementManagerImpl moveMgr , ContentHandle <T > rowsHandle ) {
7473 super (moveMgr );
75- if (rowsHandle == null )
76- throw new IllegalArgumentException ("Cannot create RowBatcher with null rows manager" );
77- if (!(rowsHandle instanceof StructureReadHandle ))
78- throw new IllegalArgumentException ("Rows handle must also be StructureReadHandle" );
79- if (!(rowsHandle instanceof BaseHandle ))
80- throw new IllegalArgumentException ("Rows handle must also be BaseHandle" );
81- if (((BaseHandle ) rowsHandle ).getFormat () == Format .UNKNOWN )
82- throw new IllegalArgumentException ("Rows handle must specify a format" );
74+ validateRowsHandle (rowsHandle );
8375 this .rowsHandle = rowsHandle ;
84- this .rowsClass = rowsHandle .getContentClass ();
85- if (this .rowsClass == null )
86- throw new IllegalArgumentException ("Rows handle cannot have a null content class" );
87- if (!DatabaseClientFactory .getHandleRegistry ().isRegistered (this .rowsClass ))
88- throw new IllegalArgumentException (
89- "Rows handle must be registered with DatabaseClientFactory.HandleFactoryRegistry"
90- );
91- defaultRowManager = getPrimaryClient ().newRowManager ();
76+
77+ defaultRowManager = getPrimaryClient ().newRowManager ();
9278 super .withBatchSize (DEFAULT_BATCH_SIZE );
9379 if (moveMgr .getConnectionType () == DatabaseClient .ConnectionType .DIRECT ) {
9480 withForestConfig (moveMgr .getForestConfig ());
9581 }
9682 }
9783
84+ private void validateRowsHandle (ContentHandle <T > rowsHandle ) {
85+ if (rowsHandle == null ) {
86+ throw new IllegalArgumentException ("Cannot create RowBatcher with null rows manager" );
87+ }
88+ if (!(rowsHandle instanceof StructureReadHandle )) {
89+ throw new IllegalArgumentException ("Rows handle must also be StructureReadHandle" );
90+ }
91+ if (!(rowsHandle instanceof BaseHandle )) {
92+ throw new IllegalArgumentException ("Rows handle must also be BaseHandle" );
93+ }
94+ if (((BaseHandle ) rowsHandle ).getFormat () == Format .UNKNOWN ) {
95+ throw new IllegalArgumentException ("Rows handle must specify a format" );
96+ }
97+
98+ Class <T > rowsClass = rowsHandle .getContentClass ();
99+ if (rowsClass == null ) {
100+ throw new IllegalArgumentException ("Rows handle cannot have a null content class" );
101+ } else if (!DatabaseClientFactory .getHandleRegistry ().isRegistered (rowsClass )) {
102+ throw new IllegalArgumentException ("Rows handle must be registered with DatabaseClientFactory.HandleFactoryRegistry" );
103+ }
104+ }
105+
98106 @ Override
99107 public RowManager getRowManager () {
100108 return defaultRowManager ;
0 commit comments