public final class RawRequest extends Object
Represents the specific Requestable keys a developer has explicitly
included or excluded for a given request, along with the phases they should be loaded in.
The class is "raw" because it is unaware of the inter-relationships between
Requestable items, such as whether or where they are included in a graph.
No processing is done, nor should be done, on the inputs.
Other classes may perform analysis and optimisations on the raw request.
To keep the data in this class "raw", it must only ever reference "entry points"
in to a data structure (e.g., a complete DependencyGraph).
Any operations that need to work with a complete, resolved list of Requestable items
(e.g., resolved excluded dependencies) should use a more appropriate class to
represent the result of that operation.
| Constructor and Description |
|---|
RawRequest() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearExcluded()
Clear all the resources from the excluded list.
|
RawRequest |
deepClone() |
void |
exclude(Collection<Requestable> resources) |
boolean |
exclude(Requestable requestableToExclude)
Adds a
Requestable to the exclusion list of resources. |
LinkedHashSet<Requestable> |
getExcluded()
Returns all
Requestable items whose content should not be served to the client in this request. |
LinkedHashSet<String> |
getExcludedAsLooseType()
Deprecated.
In the future the only method to be used will be
getExcluded(). |
Set<String> |
getExcludedData() |
LinkedHashSet<Requestable> |
getIncluded()
Get a flat set with all the resources for each type.
|
LinkedHashSet<Requestable> |
getIncluded(ResourcePhase phaseType)
Retrieve all the resources to be included by phase type.
|
LinkedHashSet<String> |
getIncludedAsLooseType()
Deprecated.
In the future the only method to be used will be
getIncluded(). |
LinkedHashMap<String,com.atlassian.json.marshal.Jsonable> |
getIncludedData() |
LinkedHashMap<String,com.atlassian.json.marshal.Jsonable> |
getIncludedData(ResourcePhase phaseType) |
boolean |
hasAny(ResourcePhase phase)
Check if anything has been requested in a given phase.
|
void |
include(Collection<Requestable> resources) |
boolean |
include(RawRequest request) |
boolean |
include(Requestable resource) |
void |
include(ResourcePhase resourcePhase,
Collection<Requestable> resources) |
boolean |
include(ResourcePhase resourcePhase,
RawRequest requestToInclude)
Adds a
Requestable to the inclusion list of resources for a specific type. |
boolean |
include(ResourcePhase resourcePhase,
Requestable resource) |
void |
includeFirst(Requestable resource) |
void |
includeFirst(ResourcePhase resourcePhase,
Requestable resource)
Adds a
Requestable to the inclusion list of resources for a specific type as the top of the priority. |
void |
removeExcluded(Requestable resource)
Deprecated.
It is deprecated due to the fact that the performance will be affected.
|
void |
setPhaseCompleted(ResourcePhase resourcePhase)
Removes all resources and data requested in
ResourcePhase and
adds them to the excluded list. |
String |
toString() |
public boolean hasAny(ResourcePhase phase)
phase - the phase to check for presence of requestables.public void clearExcluded()
public void setPhaseCompleted(@Nonnull ResourcePhase resourcePhase)
Removes all resources and data requested in ResourcePhase and
adds them to the excluded list.
API note: this method mutates the object state in a non-recoverable way. if you need to know what the request was at a particular point in time, the object would need to be cloned at that point in time.
Implementation note: since phases are sequential, this method need not exist; it could be replaced with a `getExcluded(ResourcePhase)` method, which would return all developer-excluded resources along with all included resources from all previous phases. This would allow us to make this class immutable.
@Nonnull public RawRequest deepClone()
public boolean exclude(@Nonnull Requestable requestableToExclude)
Requestable to the exclusion list of resources.requestableToExclude - The requestable resource to be excluded.true: The requestable was added to the exclusion set.
false: The requestable was not added to the exclusion set.public void exclude(@Nullable Collection<Requestable> resources)
exclude(Requestable)public boolean include(@Nonnull Requestable resource)
include(ResourcePhase, RawRequest)public void include(@Nullable Collection<Requestable> resources)
include(Requestable)public void include(@Nonnull ResourcePhase resourcePhase, @Nullable Collection<Requestable> resources)
include(ResourcePhase, Requestable)public boolean include(@Nonnull RawRequest request)
include(ResourcePhase, RawRequest)public boolean include(@Nonnull ResourcePhase resourcePhase, @Nonnull Requestable resource)
include(ResourcePhase, RawRequest)public boolean include(@Nonnull ResourcePhase resourcePhase, @Nonnull RawRequest requestToInclude)
Requestable to the inclusion list of resources for a specific type.resourcePhase - The resource resourcePhase type for the resource.requestToInclude - The requestable resource to be included.true: The requestable was added to the inclusion set.
false: The requestable was not added to the inclusion set.public void includeFirst(@Nonnull ResourcePhase resourcePhase, @Nonnull Requestable resource)
Requestable to the inclusion list of resources for a specific type as the top of the priority.resourcePhase - The resource resourcePhase type for the resource.resource - The requestable resource to be included.public void includeFirst(@Nonnull Requestable resource)
includeFirst(ResourcePhase, Requestable)@Nonnull public LinkedHashSet<Requestable> getIncluded()
@Nonnull @Deprecated public LinkedHashSet<String> getIncludedAsLooseType()
getIncluded().Requestable as their string representation for retro-compatibility.
The order is not meant to be significant. However, some products depend on it.@Nonnull public LinkedHashSet<Requestable> getIncluded(@Nonnull ResourcePhase phaseType)
phaseType - The phase type to be used for the filtering.NullPointerException - If the resource phase type is not defined.@Nonnull public LinkedHashMap<String,com.atlassian.json.marshal.Jsonable> getIncludedData(@Nonnull ResourcePhase phaseType)
@Nonnull public LinkedHashMap<String,com.atlassian.json.marshal.Jsonable> getIncludedData()
@Nonnull public LinkedHashSet<Requestable> getExcluded()
Requestable items whose content should not be served to the client in this request.@Nonnull @Deprecated public LinkedHashSet<String> getExcludedAsLooseType()
getExcluded().Requestable as their string representation for retro-compatibility.@Deprecated public void removeExcluded(@Nonnull Requestable resource)
Requestable from the current RawRequest.
To remove it will clone the current request and create a new one without specific resource.resource - The resource to be removed.Copyright © 2024 Atlassian. All rights reserved.