Package br.msf.commons.lang

Examples of br.msf.commons.lang.MatchEntry


    protected EnhancedStringBuilder getUpdatedSource(final FileObject fileObject) throws IOException {
        final EnhancedStringBuilder builder = new EnhancedStringBuilder(fileObject.asText(FileEncodingQuery.getEncoding(fileObject).name()));
        final Collection<MatchEntry> currentLicense = builder.findPattern(JAVA_LICENSE);
        if (CollectionUtils.isNotEmpty(currentLicense)) {
            MatchEntry me = currentLicense.iterator().next();
            switch (params.getUpdateMode()) {
                case ALL_FILES:
                    /* source already have a license header. lets replace it */
                    builder.replace(me, getJavaLicense());
                    break;
                case WITHOUT_LICENSE_FILES:
                    /* we consider the default netbeans template as "file without license" */
                    if (builder.substring(me.getStart(), me.getEnd()).contains(NB_LICENSE_TEMPLATE)) {
                        builder.replace(me, getJavaLicense());
                    } else {
                        /* returning null sinalize that this FileObject will not be updated */
                        return null;
                    }
View Full Code Here

TOP

Related Classes of br.msf.commons.lang.MatchEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.