public class Thing extends Resource implements ThingId, UserId, CategoryId, LanguageId
Thing
that has been registered with Flattr. Two Thing
are considered
equal if they contain the same id. Some properties of a Thing
can be modified
by setters. After that, invoke
FlattrService.update(org.shredzone.flattr4j.model.Thing)
to persist the
changes.
This class is not threadsafe.
Constructor and Description |
---|
Thing(FlattrObject data) |
Modifier and Type | Method and Description |
---|---|
void |
addTag(String tag) |
boolean |
equals(Object obj) |
String |
getCategoryId()
Category this Thing belongs to.
|
int |
getClicks()
How many times this Thing was flattred.
|
Date |
getCreated()
Creation date of the Thing.
|
String |
getDescription()
A descriptive text about the Thing.
|
String |
getImage()
URL of an image for this Thing.
|
String |
getLanguageId()
Language id of the Thing.
|
Date |
getLastFlattr()
Date of last Flattr.
|
String |
getLink()
Human readable link to this resource at Flattr.
|
String |
getQrPdfUrl()
Returns the URL of a PDF document containing a QR code of the Thing.
|
String |
getResource()
URL that returns details of this resource as JSON.
|
List<String> |
getTags()
Tags this Thing is tagged with.
|
String |
getThingId()
Thing's unique id at Flattr.
|
String |
getTitle()
Title of the Thing.
|
Date |
getUpdated()
Date of last Update.
|
String |
getUrl()
URL of the Thing.
|
User |
getUser()
User this Thing belongs to.
|
String |
getUserId()
User this Thing belongs to.
|
int |
hashCode() |
boolean |
isFlattred()
Is this Thing flattred?
|
boolean |
isHidden()
Is the Thing hidden from the public list of Things at Flattr?
|
boolean |
isSubscribed()
Is this Thing subscribed?
|
void |
merge(Submission submission)
Merges the contents of a submission to this
Thing . |
void |
setCategory(CategoryId category) |
void |
setDescription(String description) |
void |
setHidden(boolean hidden) |
void |
setLanguage(LanguageId language) |
void |
setTags(List<String> tags) |
void |
setTitle(String title) |
FlattrObject |
toUpdate()
Returns a
FlattrObject for the updates that have been applied to this
Thing. |
static ThingId |
withId(String id)
Returns a
ThingId for the given Thing id. |
toFlattrObject, toJSON
public Thing(FlattrObject data)
public static ThingId withId(String id)
ThingId
for the given Thing id.id
- Thing idThingId
object for this idpublic String getThingId()
getThingId
in interface ThingId
public String getResource()
public String getLink()
public Date getCreated()
public int getClicks()
public String getUrl()
public String getTitle()
public void setTitle(String title)
public String getImage()
public String getUserId()
public User getUser()
All properties are only available when the service was set to full mode!
public String getCategoryId()
getCategoryId
in interface CategoryId
public void setCategory(CategoryId category)
public String getDescription()
public void setDescription(String description)
public void addTag(String tag)
public String getLanguageId()
getLanguageId
in interface LanguageId
public void setLanguage(LanguageId language)
public boolean isHidden()
public void setHidden(boolean hidden)
public boolean isFlattred()
public boolean isSubscribed()
public Date getLastFlattr()
public Date getUpdated()
public void merge(Submission submission)
Thing
. This method is useful if
you want to modify an existing Thing
by a Submission
object.
For all unset properties of Submission
, the Thing
properties are
cleared. After merging, the Thing
is in a state as if it was created with
the given Submission
. If you only want to change single properties of
Thing
, use the setters instead.
NOTE: The URL of a Thing
cannot be changed. The Submission
object must contain either this Thing
's URL or null
(for
convenience). Otherwise an IllegalArgumentException
is thrown.
submission
- Submission
to mergepublic FlattrObject toUpdate()
FlattrObject
for the updates that have been applied to this
Thing.FlattrObject
for the updates, or null
if this Thing was not
modified.public String getQrPdfUrl()
Copyright © 2010–2017. All rights reserved.