@Test public void decimalColTest() { ColumnDef def1 = ColumnDef.builder().type( "DECIMAL" ).build(); ColumnDef def2 = ColumnDef.builder().type( "DECIMAL" ).build(); assertThat( "DECIMAL=DECIMAL", def1.isSameType( def2 ) ); def2.setType( ("DECIMAL(10)") ); assertThat( "DECIMAL=DECIMAL(10)", def1.isSameType( def2 ) ); def2.setType( ("DECIMAL(10, 0)") ); assertThat( "DECIMAL=DECIMAL(10, 0)", def1.isSameType( def2 ) ); def1.setType( "DECIMAL(18,8)" ); assertThat( "DECIMAL(18,0) != DECIMAL(10, 0)", !def1.isSameType( def2 ) ); def2.setType( ("DECIMAL(18, 8)") ); assertThat( "DECIMAL(18,0) != DECIMAL(18, 8)", def1.isSameType( def2 ) ); }
public boolean isSameType(ColumnDef columnDef) { if (type.equalsIgnoreCase(columnDef.getType())) { return true; } else if (type.toUpperCase().startsWith("DECIMAL") && columnDef.getType().toUpperCase().startsWith("DECIMAL")) { int[] p1 = parseDecimalType(type); int[] p2 = parseDecimalType(columnDef.type); return p1[0]==p2[0] && p1[1]==p2[1]; } return false; }
ColumnDef { public boolean isSameType(ColumnDef columnDef) { if (type.equalsIgnoreCase(columnDef.getType())) { return true; } else if (type.toUpperCase().startsWith("DECIMAL") && columnDef.getType().toUpperCase().startsWith("DECIMAL")) { int[] p1 = parseDecimalType(type); int[] p2 = parseDecimalType(columnDef.type); return p1[0]==p2[0] && p1[1]==p2[1]; } return false; } }
ColumnDef { public boolean isSameType(ColumnDef columnDef) { if (type.equalsIgnoreCase(columnDef.getType())) { return true; } else if (type.toUpperCase().startsWith("DECIMAL") && columnDef.getType().toUpperCase().startsWith("DECIMAL")) { int[] p1 = parseDecimalType(type); int[] p2 = parseDecimalType(columnDef.type); return p1[0]==p2[0] && p1[1]==p2[1]; } return false; }  }
ColumnDef { public boolean isSameType(ColumnDef columnDef) { if (type.equalsIgnoreCase(columnDef.getType())) { return true; } else if (type.toUpperCase().startsWith("DECIMAL") && columnDef.getType().toUpperCase().startsWith("DECIMAL")) { int[] p1 = parseDecimalType(type); int[] p2 = parseDecimalType(columnDef.type); return p1[0]==p2[0] && p1[1]==p2[1]; } return false; }  boolean isSameType(ColumnDef columnDef); boolean isSameColumn(ColumnDef columnDef); }
ColumnDef { public boolean isSameType(ColumnDef columnDef) { if (type.equalsIgnoreCase(columnDef.getType())) { return true; } else if (type.toUpperCase().startsWith("DECIMAL") && columnDef.getType().toUpperCase().startsWith("DECIMAL")) { int[] p1 = parseDecimalType(type); int[] p2 = parseDecimalType(columnDef.type); return p1[0]==p2[0] && p1[1]==p2[1]; } return false; }  boolean isSameType(ColumnDef columnDef); boolean isSameColumn(ColumnDef columnDef);  }