/** * Returns whether the specified scope name(s) are valid given the current scope. * * @param scopeNames The list of scope names * @return true if they are valid */ public static boolean isValid(String... scopeNames) { BuildScope currentScope = getCurrent(); if (currentScope.equals(ALL)) return true; for (String scopeName : scopeNames) { BuildScope specifiedScope = BuildScope.valueOf(scopeName.toUpperCase()); if (currentScope == specifiedScope) return true; } return false; }
/** * Enables this build scope as the curent system wide instance. */ public void enable() { System.setProperty(KEY, toString()); } }
/** * Returns the current Scope object based on the currently set "grails.scope" System property * @return The Scope object * @deprecated Relates to old Grails 2.x build system, do not use */ @Deprecated public static BuildScope getCurrent() { String key = System.getProperty(KEY); if (key == null) { key = Metadata.getCurrent().getProperty(KEY, String.class); } if (key != null) { try { return BuildScope.valueOf(key.toUpperCase()); } catch (IllegalArgumentException e) { return BuildScope.ALL; } } return BuildScope.ALL; }