public class StoredObjectRef extends Object
StoredObject
which can be placed as field within an BaseEntity
.
If the owning entity is deleted, the referenced object is also deleted if it was uploaded specifically for this reference. If it was a shared object from within a bucket, the referenced object remains untouched.
Modifier and Type | Field and Description |
---|---|
protected boolean |
changed |
protected String |
reference |
Constructor and Description |
---|
StoredObjectRef(String bucket)
Creates a new reference for the given bucket and owner.
|
StoredObjectRef(String bucket,
boolean supportsURL)
Creates a new reference for the given bucket and owner.
|
Modifier and Type | Method and Description |
---|---|
String |
getBucket()
Returns the bucket in which referenced objects are stored.
|
String |
getFilename()
Determines the filename of the referenced file or url.
|
String |
getKey()
Returns the key of the referenced object.
|
StoredObject |
getObject()
Returns the referenced object or null.
|
String |
getReference()
Returns the effective reference used for
VirtualObject.REFERENCE . |
String |
getURL(String defaultURL)
Determines the URL for this reference.
|
String |
getURLWithVersion(String version,
String defaultURL)
Determines the URL for this reference.
|
String |
getURLWithVersionAndAddonText(String version,
String addonText,
String defaultURL)
Determines the URL for this reference.
|
boolean |
isEmpty()
Determines if no object or an URL is being referenced.
|
boolean |
isFetched()
Determines if the referenced object was fetched already.
|
boolean |
isFilled()
Determines if an object or an URL is being referenced.
|
boolean |
isSupportsURL()
Determines if this reference also supports to store URLs instead of object keys.
|
boolean |
isURL()
Determines if an URL was stored instead of an object key.
|
void |
setKey(String key)
Specifies an object key to reference.
|
void |
setObject(StoredObject object)
Assigns an object to be referenced.
|
String |
toString() |
protected boolean changed
protected String reference
public StoredObjectRef(String bucket, boolean supportsURL)
bucket
- the bucket to place referenced objects insupportsURL
- if true a URL can also be used instead of an object keypublic StoredObjectRef(String bucket)
bucket
- the bucket to place referenced objects inpublic StoredObject getObject()
public void setObject(StoredObject object)
object
- the object to be referencedpublic String getURL(String defaultURL)
StoredObject
if it exists, otherwise the default URL.defaultURL
- the default URLpublic String getURLWithVersion(String version, String defaultURL)
StoredObject
if it exists, otherwise the default URL.version
- the version stringdefaultURL
- the default URLpublic String getURLWithVersionAndAddonText(String version, String addonText, String defaultURL)
StoredObject
if it exists, otherwise the default URL.version
- the version stringaddonText
- the addon text to add to the generated URLdefaultURL
- the default URLpublic void setKey(String key)
key
- the key of the object to referencepublic String getFilename()
public String getKey()
public boolean isURL()
public boolean isFilled()
public boolean isEmpty()
public boolean isFetched()
public String getBucket()
public boolean isSupportsURL()
public String getReference()
VirtualObject.REFERENCE
.Copyright © 2018. All rights reserved.