public static class RestResourceRegistry.ResourceHolder
extends java.lang.Object
Constructor and Description |
---|
ResourceHolder(java.lang.String pResourceId,
RestResourceRegistry pRegistry)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addParentResource(java.lang.String pParentResourceId)
Adds a set entry for the parent resources of this rest resource.
|
protected void |
addResourceSettings(RestResourceRegistry.ResourceSettings pResourceSettings)
Adds a resource settings to this resource info.
|
protected void |
determineRoots(RestResourceRegistry.ResourceHolder pResource,
java.util.Set<RestResourceRegistry.ResourceHolder> pAllRoots)
Recursive method to traverse up through the parent resource references to the roots for this holder.
|
java.util.Set<RestResourceRegistry.EndpointSettings> |
getAllEndpointSettings()
Gets the set of all endpoint settings in this resource info
|
java.util.Set<RestResourceRegistry.ResourceHolder> |
getAllRootResourceHolders()
Return the set of root resource holders for this resource holder
|
java.util.Set<RestResourceRegistry.SubresourceLocatorSettings> |
getAllSubresourceLocators()
Gets all the subresource locator settings for this resource.
|
java.util.Set<java.lang.String> |
getAllSubresources()
Gets a set of all the subresource ids this resource can link to.
|
java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> |
getAllTemplates()
Gets the map of all endpoint template paths in this resource info where the key is the template uri path and
the value is the endpoint settings it points to.
|
RestResourceRegistry.EndpointSettings |
getCollectionGETEndpoint()
Utility method to return the collection GET endpoint settings
|
RestResourceRegistry.EndpointSettings |
getEndpoint(java.lang.String pHttpMethod,
boolean pSingular)
Returns an endpoint setting for this resource by matching against the http method and singular vs collection.
|
java.util.Set<java.lang.String> |
getParentResources()
Gets the set of parent resource ids.
|
java.lang.String |
getPath()
The top level path uri for the resource.
|
RestResourceRegistry |
getRegistry()
Gets the rest resource registry this resource belongs to
|
java.lang.String |
getResourceId()
Gets the id for the rest resource.
|
RestResourceRegistry.ResourceSettings |
getResourceSettings(java.lang.Class<?> pResourceClass)
Gets a resource settings in this resource info for the given resource class.
|
java.util.Map<java.lang.Class<?>,RestResourceRegistry.ResourceSettings> |
getResourceSettingsMap()
Gets the map of the resource settings for this resource keyed by the resource class.
|
RestResourceRegistry.EndpointSettings |
getSingularGETEndpoint()
Utility method to return the singular GET endpoint settings
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<RestResourceRegistry.EndpointSettings>>> |
getTemplatesByParentResourcePath()
Gets a map of parent path to a map of template uri path to endpoint.
|
protected void |
initialize()
Initialize all of the various maps that keep track of endpoints, template paths and subresources
associated with this resource.
|
boolean |
isReadOnly()
Method to determine if this resource is read-only, i.e.
|
boolean |
isSubresource()
Returns true if this is a subresource, i.e.
|
protected void |
setAllEndpointSettings(java.util.Set<RestResourceRegistry.EndpointSettings> pAllEndpointSettings)
Setter for the set of all endpoint settings in this resource info
|
protected void |
setAllRootResourceHolders(java.util.Set<RestResourceRegistry.ResourceHolder> pAllRootResourceHolders)
Stter for the set of root resource holders for this resource holder
|
protected void |
setAllSubresourceLocators(java.util.Set<RestResourceRegistry.SubresourceLocatorSettings> pAllSubresourceLocators)
Setter for all the subresource locator settings for this resource.
|
protected void |
setAllSubresources(java.util.Set<java.lang.String> pAllSubresources)
Setter for a set of all the subresource ids this resource can link to.
|
protected void |
setAllTemplates(java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> pAllTemplates)
Setter for the map of all endpoint template paths in this resource info where the key is the template uri path and
the value is the endpoint settings it points to.
|
protected void |
setPath(java.lang.String pPath)
The top level path uri for the resource.
|
protected void |
setReadOnly(boolean pReadOnly)
Method to set if this resource is read-only, i.e.
|
protected void |
setRegistry(RestResourceRegistry pRegistry)
Sets the rest resource registry this resource belongs to
|
protected void |
setResourceId(java.lang.String pResourceId)
Sets the id for the rest resource.
|
protected void |
setResourceSettingsMap(java.util.Map<java.lang.Class<?>,RestResourceRegistry.ResourceSettings> pResourceSettings)
Sets the map of the resource settings for this resource keyed by the resource class.
|
protected void |
setTemplatesByParentResourcePath(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<RestResourceRegistry.EndpointSettings>>> pTemplatesByParentResourcePath)
Setter for a map of parent path to a map of template uri path to endpoint.
|
protected void |
setTrackVersion(boolean pTrackVersion)
Set to true if the framework should attempt to determine the version of this resource for inclusion in the
ETag.
|
boolean |
shouldTrackVersion()
Returns true if the framework should attempt to determine the version of this resource for inclusion in the
ETag.
|
java.lang.String |
toString() |
protected java.lang.String mResourceId
protected java.lang.String mPath
protected RestResourceRegistry mRegistry
protected java.util.Map<java.lang.Class<?>,RestResourceRegistry.ResourceSettings> mResourceSettings
protected java.util.Set<RestResourceRegistry.EndpointSettings> mAllEndpoints
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> mAllTemplates
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<RestResourceRegistry.EndpointSettings>>> mTemplatesByParentResourcePath
protected RestResourceRegistry.EndpointSettings mSingularGETEndpoint
protected RestResourceRegistry.EndpointSettings mCollectionGETEndpoint
protected java.util.Set<java.lang.String> mParentResources
protected java.util.Set<java.lang.String> mAllSubresources
protected java.util.Set<RestResourceRegistry.SubresourceLocatorSettings> mAllSubresourceLocators
protected java.util.Set<RestResourceRegistry.ResourceHolder> mAllRootResourceHolders
protected boolean mTrackVersion
protected boolean mReadOnly
public ResourceHolder(java.lang.String pResourceId, RestResourceRegistry pRegistry)
pResourceId
- id of this resource infopRegistry
- registry this resource belongs toprotected void initialize()
public java.lang.String getResourceId()
RestResource
annotation.protected void setResourceId(java.lang.String pResourceId)
RestResource
annotation.pResourceId
- The id for the Rest resource.public boolean isReadOnly()
protected void setReadOnly(boolean pReadOnly)
pReadOnly
- true if it is read only otherwise false.public boolean shouldTrackVersion()
protected void setTrackVersion(boolean pTrackVersion)
pTrackVersion
- true if the framework should determine a version for the resource else falsepublic java.util.Map<java.lang.Class<?>,RestResourceRegistry.ResourceSettings> getResourceSettingsMap()
protected void setResourceSettingsMap(java.util.Map<java.lang.Class<?>,RestResourceRegistry.ResourceSettings> pResourceSettings)
pResourceSettings
- map of the resource settings for this resource keyed by the resource class.public RestResourceRegistry.ResourceSettings getResourceSettings(java.lang.Class<?> pResourceClass)
pResourceClass
- class of the resource settings to retrieveprotected void addResourceSettings(RestResourceRegistry.ResourceSettings pResourceSettings)
pResourceSettings
- resource settings to addpublic RestResourceRegistry getRegistry()
protected void setRegistry(RestResourceRegistry pRegistry)
pRegistry
- rest resource registry this resource belongs topublic java.lang.String getPath()
protected void setPath(java.lang.String pPath)
pPath
- the top level path uri for the resource.public java.util.Set<RestResourceRegistry.EndpointSettings> getAllEndpointSettings()
protected void setAllEndpointSettings(java.util.Set<RestResourceRegistry.EndpointSettings> pAllEndpointSettings)
pAllEndpointSettings
- the set of all endpoint settings in this resource infopublic java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> getAllTemplates()
protected void setAllTemplates(java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> pAllTemplates)
pAllTemplates
- the map of all template paths keyed by path with endpoint settings value in this resource infopublic java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<RestResourceRegistry.EndpointSettings>>> getTemplatesByParentResourcePath()
protected void setTemplatesByParentResourcePath(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<RestResourceRegistry.EndpointSettings>>> pTemplatesByParentResourcePath)
pTemplatesByParentResourcePath
- map keyed by parent uri path where the value is a map keyed by endpoint template path to endpoint valuepublic RestResourceRegistry.EndpointSettings getEndpoint(java.lang.String pHttpMethod, boolean pSingular)
pHttpMethod
- http method the endpoint usespSingular
- true if the endpoint is for the singular resourcepublic RestResourceRegistry.EndpointSettings getSingularGETEndpoint()
public RestResourceRegistry.EndpointSettings getCollectionGETEndpoint()
protected void addParentResource(java.lang.String pParentResourceId)
pParentResourceId
- The id for a parent resource of this rest resource.public java.util.Set<java.lang.String> getParentResources()
public boolean isSubresource()
public java.util.Set<RestResourceRegistry.SubresourceLocatorSettings> getAllSubresourceLocators()
protected void setAllSubresourceLocators(java.util.Set<RestResourceRegistry.SubresourceLocatorSettings> pAllSubresourceLocators)
pAllSubresourceLocators
- set of subresource locator settings for this resourcepublic java.util.Set<java.lang.String> getAllSubresources()
protected void setAllSubresources(java.util.Set<java.lang.String> pAllSubresources)
pAllSubresources
- set of string subresource ids this resource can link topublic java.util.Set<RestResourceRegistry.ResourceHolder> getAllRootResourceHolders()
protected void setAllRootResourceHolders(java.util.Set<RestResourceRegistry.ResourceHolder> pAllRootResourceHolders)
pAllRootResourceHolders
- set of ResourceHolder rootsprotected void determineRoots(RestResourceRegistry.ResourceHolder pResource, java.util.Set<RestResourceRegistry.ResourceHolder> pAllRoots)
pResource
- current resource holder to be processedpAllRoots
- Set of all roots found so farpublic java.lang.String toString()
toString
in class java.lang.Object