Class Property<T>
- java.lang.Object
-
- com.tagtraum.beatunes.Property<T>
-
public abstract class Property<T> extends Object
Describes and helps manipulating a property of a given value. As such it is like a more concrete version of a
PropertyDescriptor
that supports undo (seesetUndoable(Object, Object)
).E.g. a class has a property called
name
. Use this interface to implement a class that callsgetName()
to get the value of the property orsetName(String)
to set a new value.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Property.PropertyUndoableEdit<T>
SpecialUndoableEdit
with modifiableProperty.PropertyUndoableEdit.getPresentationName()
.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Property()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract T
get(Object o)
Returns a property value.String
getFullyQualifiedName()
Returns the fully qualified name, that can be used in HQL queries, which usesong
as alias for theSong
table.static <T> Property<T>
getInstance(String propertyName)
Get property instance based on a name.abstract String
getLabel()
Label to be used as key inBeaTunes.localize(String, Object...)
.abstract String
getName()
Name of the property.String
getObjectPath()
Object path to this property.String
getSQLName()
SQL name of the property, i.e., the column name.abstract Class<? extends T>
getValueClass()
Class values are in.abstract void
set(Object o, T value)
Sets a property value.Property.PropertyUndoableEdit<T>
setUndoable(Object object, T newValue)
Sets the value of the property in an undoable way.String
toString()
-
-
-
Field Detail
-
SPECTRUM_PROPERTY
public static final Property<com.tagtraum.audiokern.timbre.BarkSpectrum> SPECTRUM_PROPERTY
-
TRACK_REPLAY_GAIN_PROPERTY
public static final Property<ReplayGain> TRACK_REPLAY_GAIN_PROPERTY
-
ALBUM_REPLAY_GAIN_PROPERTY
public static final Property<ReplayGain> ALBUM_REPLAY_GAIN_PROPERTY
-
TIME_SIGNATURE_PROPERTY
public static final Property<TimeSignature> TIME_SIGNATURE_PROPERTY
-
TEMPO_PROPERTY
public static final Property<com.tagtraum.audiokern.bpm.Tempo> TEMPO_PROPERTY
-
AUDIO_ARTWORKS_PROPERTY
public static final Property<AudioArtwork[]> AUDIO_ARTWORKS_PROPERTY
-
MEDIA_KIND_PROPERTY
public static final Property<AudioSong.MediaKind> MEDIA_KIND_PROPERTY
-
CLOUD_STATUS_PROPERTY
public static final Property<AudioSong.CloudStatus> CLOUD_STATUS_PROPERTY
-
LIKING_PROPERTY
public static final Property<AudioSong.Liking> LIKING_PROPERTY
-
ALBUM_LIKING_PROPERTY
public static final Property<AudioSong.Liking> ALBUM_LIKING_PROPERTY
-
INSTRUMENTATION_PROPERTY
public static final Property<AudioSong.Instrumentation> INSTRUMENTATION_PROPERTY
-
PROGRESS_PROPERTY
public static final Property<Object> PROGRESS_PROPERTY
DummyProperty
object used onAnalysisQueueColumnModel
. You cannot use this property to actually read or write a value. It's used merely for its name, label and renderer.
-
-
Method Detail
-
get
public abstract T get(Object o)
Returns a property value.- Parameters:
o
- object- Returns:
- the value of the property
-
set
public abstract void set(Object o, T value)
Sets a property value.- Parameters:
o
- objectvalue
- value to set
-
getName
public abstract String getName()
Name of the property.- Returns:
- property name
-
getSQLName
public String getSQLName()
SQL name of the property, i.e., the column name.- Returns:
- column name
-
getObjectPath
public String getObjectPath()
Object path to this property. E.g., if the property belongs directly to aSong
object, it's"song"
. If it belongs toSongAnnotation
, it's"song.songAnnotation"
- Returns:
- by default this returns
"song"
.
-
getFullyQualifiedName
public final String getFullyQualifiedName()
Returns the fully qualified name, that can be used in HQL queries, which use
song
as alias for theSong
table. E.g. the fully qualified name for "artist" is "song.artist". Any properties that are persisted inSongAnnotation
follow the pattern "song.songAnnotation.PROPERTY_NAME". E.g. "song.songAnnotation.custom1".The fully qualified name always consists of
.getObjectPath()
+ "." +getName()
- Returns:
- fully qualified name
-
getLabel
public abstract String getLabel()
Label to be used as key inBeaTunes.localize(String, Object...)
.- Returns:
- (not localized) label
-
setUndoable
public Property.PropertyUndoableEdit<T> setUndoable(Object object, T newValue)
Sets the value of the property in an undoable way.- Parameters:
object
- objectnewValue
- value- Returns:
- an
UndoableEdit
that allows reversal of this call. Note that the presentation name is not localized and must be adjusted, if it should be used in a localized context.
-
getValueClass
public abstract Class<? extends T> getValueClass()
Class values are in.- Returns:
- class
-
getInstance
public static <T> Property<T> getInstance(String propertyName)
Get property instance based on a name. The name can be either simple ("artist") or fully qualified ("song.songAnnotation.custom1").- Type Parameters:
T
- type of the property- Parameters:
propertyName
- name- Returns:
- property object or
null
, if not found.
-
-