org.codehaus.groovy.grails.commons.GrailsStringUtils



API Populatity

1 Client projects

Project: org.codehaus

Project grails/grails-core in file ...lassIgnoringComponentScanBeanDefinitionParser.java (2014-02-03)
@@ -32,6 +32,7 @@ import java.util.Set;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.codehaus.groovy.grails.commons.GrailsStringUtils;
 import org.codehaus.groovy.grails.plugins.GrailsPluginManager;
 import org.codehaus.groovy.runtime.DefaultGroovyMethods;
 import org.springframework.beans.factory.BeanFactory;
@@ -242,7 +243,7 @@ public class ClosureClassIgnoringComponentScanBeanDefinitionParser extends Compo
             @Override
             public boolean match(String pattern, String path) {
                 if (path.endsWith(".class")) {
-                    String filename = StringUtils.stripFilenameExtension(StringUtils.getFilename(path));
+                    String filename = GrailsStringUtils.getFileBasename(path);
                     if (filename.contains("$")) return false;
                 }
                 return super.match(pattern, path);
Project grails/grails-core in file ...upport.PluginAwareResourceBundleMessageSource.java (2014-02-03)
@@ -34,6 +34,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.codehaus.groovy.grails.commons.GrailsApplication;
+import org.codehaus.groovy.grails.commons.GrailsStringUtils;
 import org.codehaus.groovy.grails.plugins.BinaryGrailsPlugin;
 import org.codehaus.groovy.grails.plugins.GrailsPlugin;
 import org.codehaus.groovy.grails.plugins.GrailsPluginInfo;
@@ -107,9 +108,7 @@ public class PluginAwareResourceBundleMessageSource extends ReloadableResourceBu
                     basePath = WEB_INF_PLUGINS_PATH.substring(1) + plugin.getFileSystemName();
                 }
 
-                String fileName = StringUtils.stripFilenameExtension(pluginBundle.getFilename());
-                int i = fileName.indexOf("_");
-                final String baseName = i > -1 ? fileName.substring(0, i) : fileName;
+                final String baseName = GrailsStringUtils.substringBefore(GrailsStringUtils.getFileBasename(pluginBundle.getFilename()), "_");
                 pluginBaseNames.add(basePath + "/grails-app/i18n/" + baseName);
             }
         }
Project grails/grails-core in file ...haus.groovy.grails.validation.BlankConstraint.java (2014-03-27)
@@ -1,86 +0,0 @@
-/*
- * Copyright 2004-2005 Graeme Rocher
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.codehaus.groovy.grails.validation;
-
-import org.codehaus.groovy.grails.commons.GrailsStringUtils;
-import org.springframework.validation.Errors;
-
-/**
- * A Constraint that validates a string is not blank.
- *
- * @author Graeme Rocher
- * @since 0.4
- */
-public class BlankConstraint extends AbstractVetoingConstraint {
-
-    private boolean blank;
-
-    /* (non-Javadoc)
-     * @see org.codehaus.groovy.grails.validation.Constraint#supports(java.lang.Class)
-     */
-    @SuppressWarnings("rawtypes")
-    public boolean supports(Class type) {
-        return type != null && String.class.isAssignableFrom(type);
-    }
-
-    @Override
-    public Object getParameter() {
-        return blank;
-    }
-
-    public boolean isBlank() {
-        return blank;
-    }
-
-    /* (non-Javadoc)
-     * @see org.codehaus.groovy.grails.validation.ConstrainedProperty.AbstractConstraint#setParameter(java.lang.Object)
-     */
-    @Override
-    public void setParameter(Object constraintParameter) {
-        if (!(constraintParameter instanceof Boolean)) {
-            throw new IllegalArgumentException("Parameter for constraint [" +
-                    ConstrainedProperty.BLANK_CONSTRAINT + "] of property [" +
-                    constraintPropertyName + "] of class [" + constraintOwningClass +
-                    "] must be a boolean value");
-        }
-
-        blank = (Boolean)constraintParameter;
-        super.setParameter(constraintParameter);
-    }
-
-    public String getName() {
-        return ConstrainedProperty.BLANK_CONSTRAINT;
-    }
-
-    @Override
-    protected boolean skipBlankValues() {
-        return false;
-    }
-
-    @Override
-    protected boolean processValidateWithVetoing(Object target, Object propertyValue, Errors errors) {
-        if (propertyValue instanceof String && GrailsStringUtils.isBlank((String)propertyValue)) {
-            if (!blank) {
-                Object[] args = new Object[] { constraintPropertyName, constraintOwningClass };
-                rejectValue(target, errors, ConstrainedProperty.DEFAULT_BLANK_MESSAGE_CODE,
-                        ConstrainedProperty.BLANK_CONSTRAINT, args);
-                // empty string is caught by 'blank' constraint, no addition validation needed
-                return true;
-            }
-        }
-        return false;
-    }
-}