Class Title
- java.lang.Object
-
- nl.vpro.domain.AbstractOwnedText<Title>
-
- nl.vpro.domain.media.support.Title
-
- All Implemented Interfaces:
Serializable
,CharSequence
,Comparable<TypedText>
,Supplier<String>
,Child<MediaObject>
,Identifiable<Long>
,nl.vpro.domain.media.support.MutableOwnable
,nl.vpro.domain.media.support.Ownable
,Typable<TextualType>
,OwnedText
,TypedText
@Entity public class Title extends AbstractOwnedText<Title> implements Serializable, Child<MediaObject>, Identifiable<Long>
AMediaObject
can have more than one title which should differ in type and owner.To some extent a titles type describes a usage scenario. In most cases the main title will be used.
The title owner describes the origin of the title. Several media suppliers provide their own titles. To prevent conflicts while updating incoming data, all titles are stored for later usage. With the restriction that there are no titles t1 and t2 such that t1.equals(t2).
This class confirms to a natural ordering consistent with equals based on its type and owner. Beware of the fact that the title value itself has no part in the ordering algorithm. Two titles are equal if their owner and type are equal. When adding a title to a SortedSet which already contains an equal title, the added title automatically replaces the existing title.
The ordering of titles is dictated by the order (ordinal numbers) of the enum values for a titles type and ownertype.
- Since:
- 0.4
- Author:
- Roelof Jan Koekoek
- See Also:
TextualType
,OwnerType
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected MediaObject
parent
protected @NotNull(message="{nl.vpro.constraints.NotNull}") @Size(min=1,message="{nl.vpro.constraints.text.Size.min}") @Size(max=255,message="{nl.vpro.constraints.text.Size.max}") @NoHtml String
value
-
Fields inherited from class nl.vpro.domain.AbstractOwnedText
owner, type
-
-
Constructor Summary
Constructors Constructor Description Title()
Title(@NonNull String title, @NonNull nl.vpro.domain.media.support.OwnerType owner, @NonNull TextualType type)
Creates a newTitle
with a length of 256 characters.Title(@NonNull String title, @NonNull nl.vpro.domain.media.support.OwnerType owner, @NonNull TextualType type, boolean crop)
Optional constructor to bypass cropping the title to a length of 256 characters which is the default.Title(Title source)
Title(Title source, MediaObject parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Title
copy(Title source)
static Title
copy(Title source, MediaObject parent)
void
crop()
void
crop(int stop)
void
crop(int start, int stop)
boolean
equals(Object o)
String
get()
Long
getId()
MediaObject
getParent()
String
getTitle()
Deprecated.int
hashCode()
static Title
main(String main)
static Title
main(String main, nl.vpro.domain.media.support.OwnerType type)
boolean
mayContainNewLines()
void
set(String s)
void
setParent(MediaObject parent)
void
setTitle(String title)
Deprecated.static Title
shortTitle(String main)
static Title
shortTitle(String main, nl.vpro.domain.media.support.OwnerType type)
protected static String
strip(String s)
static Title
sub(String main, nl.vpro.domain.media.support.OwnerType type)
-
Methods inherited from class nl.vpro.domain.AbstractOwnedText
getOwner, getType, setOwner, setType, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
Methods inherited from interface nl.vpro.domain.OwnedText
compareTo, fullString
-
Methods inherited from interface nl.vpro.domain.TypedText
charAt, length, subSequence
-
-
-
-
Field Detail
-
value
@NotNull(message="{nl.vpro.constraints.NotNull}") @Size(min=1,message="{nl.vpro.constraints.text.Size.min}") @Size(max=255,message="{nl.vpro.constraints.text.Size.max}") @NoHtml protected @NotNull(message="{nl.vpro.constraints.NotNull}") @Size(min=1,message="{nl.vpro.constraints.text.Size.min}") @Size(max=255,message="{nl.vpro.constraints.text.Size.max}") @NoHtml String value
-
parent
protected MediaObject parent
-
-
Constructor Detail
-
Title
public Title(@NonNull String title, @NonNull nl.vpro.domain.media.support.OwnerType owner, @NonNull TextualType type)
Creates a newTitle
with a length of 256 characters.
-
Title
public Title(@NonNull String title, @NonNull nl.vpro.domain.media.support.OwnerType owner, @NonNull TextualType type, boolean crop)
Optional constructor to bypass cropping the title to a length of 256 characters which is the default.
-
Title
public Title(Title source)
-
Title
public Title(Title source, MediaObject parent)
-
Title
public Title()
-
-
Method Detail
-
copy
public static Title copy(Title source, MediaObject parent)
-
shortTitle
public static Title shortTitle(String main, nl.vpro.domain.media.support.OwnerType type)
-
crop
public void crop()
-
crop
public void crop(int stop)
-
crop
public void crop(int start, int stop)
-
getId
public Long getId()
- Specified by:
getId
in interfaceIdentifiable<Long>
-
getTitle
@Deprecated public String getTitle()
Deprecated.
-
setTitle
@Deprecated public void setTitle(String title)
Deprecated.
-
get
public String get()
-
getParent
public MediaObject getParent()
- Specified by:
getParent
in interfaceChild<MediaObject>
-
setParent
public void setParent(MediaObject parent)
- Specified by:
setParent
in interfaceChild<MediaObject>
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classAbstractOwnedText<Title>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractOwnedText<Title>
-
mayContainNewLines
public boolean mayContainNewLines()
- Specified by:
mayContainNewLines
in interfaceTypedText
-
-