Class ResourceResult<T extends Resource>
- java.lang.Object
-
- org.linuxforhealth.fhir.persistence.ResourceResult<T>
-
public class ResourceResult<T extends Resource> extends java.lang.Object
The base result wrapper used to represent a resource being returned from a persistence interaction. Instances are immutable and can be constructed vianew ResourceResult.Builder<T>()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ResourceResult.Builder<T extends Resource>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends Resource>
ResourceResult.Builder<T>builder()
Create a Builder for building instances of this classstatic ResourceResult<? extends Resource>
from(Resource resource)
Convenience method to convert a Resource value to a ResourceResult, which is useful for unit-testsjava.time.Instant
getLastUpdated()
java.lang.String
getLogicalId()
T
getResource()
The resource resulting from the interactionjava.lang.String
getResourceTypeName()
int
getVersion()
boolean
isDeleted()
Whether or not the resource is deletedstatic java.util.List<? extends Resource>
toResourceList(java.util.List<ResourceResult<? extends Resource>> resourceResults)
Convenience function to convert a list of ResourceResults to a list of Resources which are not nulljava.lang.String
toString()
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
builder
public static <T extends Resource> ResourceResult.Builder<T> builder()
Create a Builder for building instances of this class- Returns:
-
from
public static ResourceResult<? extends Resource> from(Resource resource)
Convenience method to convert a Resource value to a ResourceResult, which is useful for unit-tests- Type Parameters:
T
-- Parameters:
resource
- with a valid meta field- Returns:
-
toResourceList
public static java.util.List<? extends Resource> toResourceList(java.util.List<ResourceResult<? extends Resource>> resourceResults)
Convenience function to convert a list of ResourceResults to a list of Resources which are not null- Parameters:
resourceResults
-- Returns:
-
isDeleted
public boolean isDeleted()
Whether or not the resource is deleted- Returns:
- whether the resource is deleted
-
getResource
public T getResource()
The resource resulting from the interaction- Returns:
- An immutable object of type
Resource
.
-
getResourceTypeName
public java.lang.String getResourceTypeName()
- Returns:
- the resourceTypeName
-
getLogicalId
public java.lang.String getLogicalId()
- Returns:
- the logicalId
-
getVersion
public int getVersion()
- Returns:
- the version
-
getLastUpdated
public java.time.Instant getLastUpdated()
- Returns:
- the lastUpdated
-
-