ResourceLocator (Grails 2.3.8)
Date: 2014-04-24

Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.codehaus.groovy.grails.core.io
[Java] Interface ResourceLocator

    public interface ResourceLocator

Used to locate resources at development or production time.

Authors:
  Graeme Rocher

Since:
  2.0

Method Summary
`org.springframework.core.io.Resource` | `findResourceForClassName(java.lang.String className)` Finds the .groovy file or .java file for a given class from a Grails project.
`org.springframework.core.io.Resource` | `findResourceForURI(java.lang.String uri)` Finds a resource for the given URI
`void` | `setSearchLocation(java.lang.String searchLocation)` The basic location from which to conduct the search.
`void` | `setSearchLocations(java.util.Collection searchLocations)` Multiple locations to search.

Method Detail

### findResourceForClassName

    public org.springframework.core.io.Resource findResourceForClassName(java.lang.String className)

  Finds the .groovy file or .java file for a given class from a Grails project. Note that this method will return null in production since sources are not packaged unless an appropriate search location is specified to locate the resource
  Parameters:
    `className` - The class name
  Returns:
    The resource or null

### findResourceForURI

    public org.springframework.core.io.Resource findResourceForURI(java.lang.String uri)

  Finds a resource for the given URI
  Parameters:
    `uri` - The URI
  Returns:
    The resource or null if it doesn't exist

### setSearchLocation

    public void setSearchLocation(java.lang.String searchLocation)

  The basic location from which to conduct the search. At development time this is the base directory, during production this would be the servlet root
  Parameters:
    `searchLocation` - The search location

### setSearchLocations

    public void setSearchLocations(java.util.Collection searchLocations)

  Multiple locations to search. See #setSearchLocation
  Parameters:
    `searchLocations` - The locations to search

Groovy Documentation