br.com.caelum.vraptor.environment
Class DefaultEnvironment

java.lang.Object
  extended by br.com.caelum.vraptor.environment.DefaultEnvironment
All Implemented Interfaces:
Environment

@ApplicationScoped
@Component
public class DefaultEnvironment
extends Object
implements Environment

A default environment implementation which loads the environment file based on the br.com.caelum.vraptor.environment property in the context init parameter.

Author:
Alexandre Atoji, Andrew Kurauchi, Guilherme Silveira

Constructor Summary
DefaultEnvironment(javax.servlet.ServletContext context)
           
 
Method Summary
 String get(String key)
          Returns a key
 Iterable<String> getKeys()
           
 String getName()
          Returns the environment name
 URL getResource(String name)
          Locates a resource according to your current environment.
 boolean has(String key)
          Checks if a key is present
 void set(String key, String value)
          Sets a key in memory.
 boolean supports(String feature)
          Checks if a key is equals to true if it's not present will return false
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEnvironment

public DefaultEnvironment(javax.servlet.ServletContext context)
                   throws IOException
Throws:
IOException
Method Detail

supports

public boolean supports(String feature)
Description copied from interface: Environment
Checks if a key is equals to true if it's not present will return false

Specified by:
supports in interface Environment

has

public boolean has(String key)
Description copied from interface: Environment
Checks if a key is present

Specified by:
has in interface Environment

get

public String get(String key)
Description copied from interface: Environment
Returns a key

Specified by:
get in interface Environment

set

public void set(String key,
                String value)
Description copied from interface: Environment
Sets a key in memory. This will *not* affect any configuration file.

Specified by:
set in interface Environment

getKeys

public Iterable<String> getKeys()
Specified by:
getKeys in interface Environment

getResource

public URL getResource(String name)
Description copied from interface: Environment
Locates a resource according to your current environment.

Specified by:
getResource in interface Environment

getName

public String getName()
Description copied from interface: Environment
Returns the environment name

Specified by:
getName in interface Environment


Copyright © 2011. All Rights Reserved.