shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/note/NoteShadowAlgorithmUtil.java
/**
     * Parse simple SQL note.
     *
     * @param sqlNoteValue SQL note value
     * @return note map
     */
Parse simple SQL note.
@param sqlNoteValue SQL note value
@return note map
Parse simple SQL note . @param sqlNoteValue SQL note value @return note map
public static Optional<Map<String, String>> parseSimpleSQLNote(final String sqlNoteValue) {
        String noteValue = sqlNoteValue.trim();
        if (noteValue.startsWith(SIMPLE_SQL_NOTE_PREFIX)) {
            noteValue = removePrefix(noteValue);
        }
        if (noteValue.endsWith(SIMPLE_SQL_NOTE_SUFFIX)) {
            noteValue = removeSuffix(noteValue);
        }
        if (isBlank(noteValue)) {
            return Optional.empty();
        } else {
            noteValue = noteValue.trim();
            String[] noteElements = noteValue.split(SIMPLE_SQL_NOTE_SPACE);
            Map<String, String> result = new HashMap<>(noteElements.length);
            for (String each : noteElements) {
                String temp = each;
                temp = temp.trim();
                String[] split = temp.split(SIMPLE_SQL_NOTE_ELEMENT_SPACE);
                if (2 == split.length) {
                    result.put(split[0].trim(), split[1].trim());
                }
            }
            return Optional.of(result);
        }
    }
public static Optional < Map < String , String > > parseSimpleSQLNote ( final String sqlNoteValue ) { String noteValue = sqlNoteValue . trim ( ) ; if ( noteValue . startsWith ( SIMPLE_SQL_NOTE_PREFIX ) ) { noteValue = removePrefix ( noteValue ) ; } if ( noteValue . endsWith ( SIMPLE_SQL_NOTE_SUFFIX ) ) { noteValue = removeSuffix ( noteValue ) ; } if ( isBlank ( noteValue ) ) { return Optional . empty ( ) ; } else { noteValue = noteValue . trim ( ) ; String [ ] noteElements = noteValue . split ( SIMPLE_SQL_NOTE_SPACE ) ; Map < String , String > result = new HashMap < > ( noteElements . length ) ; for ( String each : noteElements ) { String temp = each ; temp = temp . trim ( ) ; String [ ] split = temp . split ( SIMPLE_SQL_NOTE_ELEMENT_SPACE ) ; if ( 2 == split . length ) { result . put ( split [ 0 ] . trim ( ) , split [ 1 ] . trim ( ) ) ; } } return Optional . of ( result ) ; } }
Parse simple SQL note.
Parse simple SQL note .