com.flexive.shared
Class FxReferenceMetaData<T extends java.io.Serializable>

java.lang.Object
  extended by com.flexive.shared.FxReferenceMetaData<T>
Type Parameters:
T - the key type
All Implemented Interfaces:
java.io.Serializable, java.util.Map<java.lang.String,java.lang.String>

public class FxReferenceMetaData<T extends java.io.Serializable>
extends java.lang.Object
implements java.io.Serializable, java.util.Map<java.lang.String,java.lang.String>

Metadata about a content instance, not attached to the content itself but to an external content reference (e.g. a briefcase item).

Since:
3.1
Version:
$Rev: 2919 $
Author:
Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
FxReferenceMetaData()
           
FxReferenceMetaData(T reference)
           
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
static FxReferenceMetaData createNew()
           
static
<T extends java.io.Serializable>
FxReferenceMetaData<T>
createNew(T key)
           
 java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> entrySet()
           
 boolean equals(java.lang.Object o)
           
static
<T extends java.io.Serializable>
FxReferenceMetaData<T>
find(java.util.List<FxReferenceMetaData<T>> items, T reference)
          Returns the item that matches the given reference, or null if no such item was found.
static
<T extends FxPK>
FxReferenceMetaData<T>
findByContent(java.util.List<FxReferenceMetaData<T>> items, T reference)
          Returns the item that matches the given reference, or null if no such item was found.
static
<T extends java.io.Serializable>
FxReferenceMetaData<T>
fromSerializedForm(T key, java.lang.String metadata)
          Create a new instance from metadata serialized by calling getSerializedForm().
 java.lang.String get(java.lang.Object key)
           
 java.lang.String get(java.lang.String key)
           
 java.lang.String get(java.lang.String key, java.lang.String defaultValue)
           
 boolean getBoolean(java.lang.String key, boolean defaultValue)
           
 double getDouble(java.lang.String key, double defaultValue)
           
 int getInt(java.lang.String key, int defaultValue)
           
 long getLong(java.lang.String key, long defaultValue)
           
 T getReference()
           
 java.lang.String getSerializedForm()
          Return a plain string serialization of the metadata attributes.
 java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
           
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Set<java.lang.String> keySet()
           
 void merge(FxReferenceMetaData<?> other)
          Merges this metadata instance with another.
 FxReferenceMetaData put(java.lang.String key, java.lang.Number value)
           
 java.lang.String put(java.lang.String key, java.lang.String value)
           
 void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.String> m)
           
 java.lang.String remove(java.lang.Object key)
           
 int size()
           
 java.lang.String toString()
           
 java.util.Collection<java.lang.String> values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FxReferenceMetaData

public FxReferenceMetaData()

FxReferenceMetaData

public FxReferenceMetaData(T reference)
Method Detail

createNew

public static FxReferenceMetaData createNew()

createNew

public static <T extends java.io.Serializable> FxReferenceMetaData<T> createNew(T key)

getSerializedForm

public java.lang.String getSerializedForm()
Return a plain string serialization of the metadata attributes. The result can be parsed by fromSerializedForm(java.io.Serializable, String).

Returns:
a plain string serialization of the metadata attributes.

merge

public void merge(FxReferenceMetaData<?> other)
Merges this metadata instance with another. Existing values get overwritten. To remove a value, specify its key with a null or empty string.

Parameters:
other - the metadata object to be applied to this one

getReference

public T getReference()

put

public FxReferenceMetaData put(java.lang.String key,
                               java.lang.Number value)

get

public java.lang.String get(java.lang.String key)

get

public java.lang.String get(java.lang.String key,
                            java.lang.String defaultValue)

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String defaultValue)

getInt

public int getInt(java.lang.String key,
                  int defaultValue)

getLong

public long getLong(java.lang.String key,
                    long defaultValue)

getDouble

public double getDouble(java.lang.String key,
                        double defaultValue)

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean defaultValue)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Map<java.lang.String,java.lang.String>
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Map<java.lang.String,java.lang.String>
Overrides:
hashCode in class java.lang.Object

size

public int size()
Specified by:
size in interface java.util.Map<java.lang.String,java.lang.String>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map<java.lang.String,java.lang.String>

put

public java.lang.String put(java.lang.String key,
                            java.lang.String value)
Specified by:
put in interface java.util.Map<java.lang.String,java.lang.String>

putAll

public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.String> m)
Specified by:
putAll in interface java.util.Map<java.lang.String,java.lang.String>

get

public java.lang.String get(java.lang.Object key)
Specified by:
get in interface java.util.Map<java.lang.String,java.lang.String>

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map<java.lang.String,java.lang.String>

remove

public java.lang.String remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<java.lang.String,java.lang.String>

clear

public void clear()
Specified by:
clear in interface java.util.Map<java.lang.String,java.lang.String>

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map<java.lang.String,java.lang.String>

keySet

public java.util.Set<java.lang.String> keySet()
Specified by:
keySet in interface java.util.Map<java.lang.String,java.lang.String>

values

public java.util.Collection<java.lang.String> values()
Specified by:
values in interface java.util.Map<java.lang.String,java.lang.String>

entrySet

public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> entrySet()
Specified by:
entrySet in interface java.util.Map<java.lang.String,java.lang.String>

fromSerializedForm

public static <T extends java.io.Serializable> FxReferenceMetaData<T> fromSerializedForm(T key,
                                                                                         java.lang.String metadata)
Create a new instance from metadata serialized by calling getSerializedForm().

Parameters:
metadata - the serialized metadata
Returns:
a new metadata instance

find

public static <T extends java.io.Serializable> FxReferenceMetaData<T> find(java.util.List<FxReferenceMetaData<T>> items,
                                                                           T reference)
Returns the item that matches the given reference, or null if no such item was found.

Type Parameters:
T - the reference type
Parameters:
items - the metadata items to be queried
reference - the metadata reference
Returns:
the item that matches the given reference, or null if no such item was found.

findByContent

public static <T extends FxPK> FxReferenceMetaData<T> findByContent(java.util.List<FxReferenceMetaData<T>> items,
                                                                    T reference)
Returns the item that matches the given reference, or null if no such item was found. Different version of the same content are treated as equal, i.e. the version information will not be used in the test.

Type Parameters:
T - the reference type
Parameters:
items - the metadata items to be queried
reference - the metadata reference
Returns:
the item that matches the given reference, or null if no such item was found.