common_code/src/main/java/com/xiongyingqi/utils/code/CodeProcessor.java
private String checkSuperClass(String classSegment) {
        if (builder.isRemoveSuperClass() || builder.getSuperClass() != null) {
            Matcher matcher = PATTERN_FIND_SUPER_CLASS.matcher(classSegment);
            String superClassString = "";
            if (builder.getSuperClass() != null) {
                superClassString = "extends " + builder.getSuperClass() + " ";
            }

            if (matcher.find()) {
                String replacement = matcher.group();
                classSegment = StringHelper.replaceFirst(classSegment, replacement, superClassString);
            } else {
                Matcher classNameMatcher = PATTERN_FIND_CLASS_NAME.matcher(classSegment);
                if (classNameMatcher.find()) {
                    String className = classNameMatcher.group();
                    String justClassName = findClassName(className);
                    if (justClassName != null && justClassName.equals(builder.getSuperClass())) {
                        return classSegment;
                    }
                    classSegment = StringHelper.replaceFirst(classSegment, className, className + superClassString);
                }
            }

        }
        return classSegment;
    }
private String checkSuperClass(String classSegment) {
        if (builder.isRemoveSuperClass() || builder.getSuperClass() != null) {
            Matcher matcher = PATTERN_FIND_SUPER_CLASS.matcher(classSegment);
            String superClassString = "";
            if (builder.getSuperClass() != null) {
                superClassString = "extends " + builder.getSuperClass() + " ";
            }

            if (matcher.find()) {
                String replacement = matcher.group();
                classSegment = StringHelper.replaceFirst(classSegment, replacement, superClassString);
            } else {
                Matcher classNameMatcher = PATTERN_FIND_CLASS_NAME.matcher(classSegment);
                if (classNameMatcher.find()) {
                    String className = classNameMatcher.group();
                    String justClassName = findClassName(className);
                    if (justClassName != null && justClassName.equals(builder.getSuperClass())) {
                        return classSegment;
                    }
                    classSegment = StringHelper.replaceFirst(classSegment, className, className + superClassString);
                }
            }

        }
        return classSegment;
    }
private String checkSuperClass ( String classSegment ) { if ( builder . isRemoveSuperClass ( ) || builder . getSuperClass ( ) != null ) { Matcher matcher = PATTERN_FIND_SUPER_CLASS . matcher ( classSegment ) ; String superClassString = "" ; if ( builder . getSuperClass ( ) != null ) { superClassString = "extends " + builder . getSuperClass ( ) + " " ; } if ( matcher . find ( ) ) { String replacement = matcher . group ( ) ; classSegment = StringHelper . replaceFirst ( classSegment , replacement , superClassString ) ; } else { Matcher classNameMatcher = PATTERN_FIND_CLASS_NAME . matcher ( classSegment ) ; if ( classNameMatcher . find ( ) ) { String className = classNameMatcher . group ( ) ; String justClassName = findClassName ( className ) ; if ( justClassName != null && justClassName . equals ( builder . getSuperClass ( ) ) ) { return classSegment ; } classSegment = StringHelper . replaceFirst ( classSegment , className , className + superClassString ) ; } } } return classSegment ; }
检查extends关键字

@param classSegment
@return
检查extends关键字