private void showColumnMeta ( PrintStream output , CfDef cfDef , ColumnDef colDef ) { output . append ( NEWLINE + TAB + TAB + "{" ) ; final AbstractType < ? > comparator = getFormatType ( cfDef . column_type . equals ( "Super" ) ? cfDef . subcomparator_type : cfDef . comparator_type ) ; output . append ( "column_name : '" + CliUtils . escapeSQLString ( comparator . getString ( colDef . name ) ) + "'," + NEWLINE ) ; String validationClass = normaliseType ( colDef . validation_class , "org.apache.cassandra.db.marshal" ) ; output . append ( TAB + TAB + "validation_class : " + CliUtils . escapeSQLString ( validationClass ) ) ; if ( colDef . isSetIndex_name ( ) ) { output . append ( "," ) . append ( NEWLINE ) . append ( TAB + TAB + "index_name : '" + CliUtils . escapeSQLString ( colDef . index_name ) + "'," + NEWLINE ) . append ( TAB + TAB + "index_type : " + CliUtils . escapeSQLString ( Integer . toString ( colDef . index_type . getValue ( ) ) ) ) ; if ( colDef . index_options != null && ! colDef . index_options . isEmpty ( ) ) { output . append ( "," ) . append ( NEWLINE ) ; output . append ( TAB + TAB + "index_options : {" + NEWLINE ) ; int numOpts = colDef . index_options . size ( ) ; for ( Map . Entry < String , String > entry : colDef . index_options . entrySet ( ) ) { String option = CliUtils . escapeSQLString ( entry . getKey ( ) ) ; String optionValue = CliUtils . escapeSQLString ( entry . getValue ( ) ) ; output . append ( TAB + TAB + TAB ) . append ( "'" + option + "' : '" ) . append ( optionValue ) . append ( "'" ) ; if ( -- numOpts > 0 ) output . append ( "," ) . append ( NEWLINE ) ; } output . append ( "}" ) ; } } output . append ( "}" ) ; }
Writes the supplied ColumnDef to the StringBuilder as a cli script .