net.sf.javaprinciples.resource.servlet
Class ResourceModel<T>

java.lang.Object
  extended by net.sf.javaprinciples.resource.servlet.ResourceModel<T>

public class ResourceModel<T>
extends Object


Constructor Summary
ResourceModel()
           
 
Method Summary
 void addProperty(String name, String value)
          Add a property that would be returned in the header.
 String getProperty(String key)
          The property value for a key.
 Set<String> getPropertyKeys()
          A method to iterator the properties.
 Resource<T> getResource()
          The resource previously set.
 int getStatusCode()
          A status code that may have been optional set.
 void setResource(Resource<T> resource)
          The resource that contains the data of interest.
 void setStatusCode(int statusCode)
          A code that will be set on the response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceModel

public ResourceModel()
Method Detail

setStatusCode

public void setStatusCode(int statusCode)
A code that will be set on the response.

Parameters:
statusCode - An Http status code or zero for dont care.

getStatusCode

public int getStatusCode()
A status code that may have been optional set.

Returns:
Zero indicates no code set.

addProperty

public void addProperty(String name,
                        String value)
Add a property that would be returned in the header.

Parameters:
name - A header name
value - Any string value

getPropertyKeys

public Set<String> getPropertyKeys()
A method to iterator the properties.

Returns:
The key set that backs the properties. Never null.

getProperty

public String getProperty(String key)
The property value for a key.

Parameters:
key - Hopefully a key that was returned in addProperty.
Returns:
Null if an invalid key is used.

setResource

public void setResource(Resource<T> resource)
The resource that contains the data of interest.

Parameters:
resource - Must not be null.

getResource

public Resource<T> getResource()
The resource previously set.

Returns:
May be null.


Copyright © 2013. All Rights Reserved.