|
2.8.3: 2008-10-15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.basedb.core.Metadata<C>
public class Metadata<C>
Utility methods for retreiving metadata about items.
Field Summary | |
---|---|
private static Set<Item> |
annotatableItems
|
private ClassMetadata |
classMetadata
|
private static Set<Item> |
diskConsumableItems
|
private String |
entityName
|
private static Set<Item> |
fileStoreEnabledItems
|
private static Map<String,Metadata<?>> |
instances
Cache of Metadata instances. |
private static boolean |
isInitialised
|
private static Set<Item> |
ownableItems
|
private static Set<Item> |
removableItems
|
private static Set<Item> |
shareableItems
|
Constructor Summary | |
---|---|
private |
Metadata(String entityName)
|
Method Summary | ||
---|---|---|
static Set<Item> |
getAnnotatableItems()
Get a set containing all Annotatable item types. |
|
static Set<Item> |
getDiskConsumableItems()
Get a set containing all DiskConsumable item types. |
|
static Set<Item> |
getFileStoreEnabledItems()
Get a set containing all FileStoreEnabled item types. |
|
private static Set<Item> |
getImplementingItems(Class<?> clazz)
Get all Item :s implementing/extinding the specified
interface/class. |
|
static
|
getInstance(Class<I> itemClass)
Get the metadata instance for the specified type of item. |
|
static
|
getInstance(Class<I> clazz,
String entityName)
Get the metadata instance for the item with the specified entity name. |
|
static Set<Item> |
getOwnableItems()
Get a set containing all Ownable item types. |
|
static Object |
getPropertyValue(BasicItem item,
String propertyName)
Get the value of a property of an item. |
|
Object |
getPropertyValue(DbControl dc,
C item,
String propertyName)
Get the value of a property of an item. |
|
static Set<Item> |
getRemovableItems()
Get a set containing all Removable item types. |
|
static Set<Item> |
getShareableItems()
Get a set containing all Shareable item types. |
|
(package private) static void |
init()
|
|
String |
toString()
|
|
(package private) static void |
unload()
Unload all settings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static Set<Item> annotatableItems
private static Set<Item> shareableItems
private static Set<Item> removableItems
private static Set<Item> ownableItems
private static Set<Item> diskConsumableItems
private static Set<Item> fileStoreEnabledItems
private static boolean isInitialised
private static final Map<String,Metadata<?>> instances
private final ClassMetadata classMetadata
private final String entityName
Constructor Detail |
---|
private Metadata(String entityName) throws BaseException
BaseException
Method Detail |
---|
static void init()
static void unload()
public static Object getPropertyValue(BasicItem item, String propertyName) throws BaseException
get
method of the item. Ie.
the following method calls are equivalent:
String name = item.getName(); String name = (String)Metadata.getProperty(item, "name");You can even use dot notation to navigate to associated items:
String quota = item.getOwner().getQuota().getName(); String quota = (String)Metadata.getProperty(item, "owner.quota.name");
item
- The item object to get the value from. Null is not allowedpropertyName
- The name of the property to get
BaseException
- If something goes wrong.
InvalidUseOfNullException
- If required parameter is nullprivate static Set<Item> getImplementingItems(Class<?> clazz)
Item
:s implementing/extinding the specified
interface/class.
public static Set<Item> getAnnotatableItems()
Annotatable
item types.
The set cannot be modified.
public static Set<Item> getShareableItems()
Shareable
item types.
The set cannot be modified.
public static Set<Item> getRemovableItems()
Removable
item types.
The set cannot be modified.
public static Set<Item> getOwnableItems()
Ownable
item types.
The set cannot be modified.
public static Set<Item> getDiskConsumableItems()
DiskConsumable
item types.
The set cannot be modified.
public static Set<Item> getFileStoreEnabledItems()
FileStoreEnabled
item types.
The set cannot be modified.
public static <I> Metadata<I> getInstance(Class<I> itemClass) throws BaseException
I
- itemClass
- The class of the item
BaseException
- If a new instance could not be created.public static <I> Metadata<I> getInstance(Class<I> clazz, String entityName) throws BaseException
I
- clazz
- The class of the item, should be either a
BasicItem or BasicData classentityName
- The entity name for the item, normally
this is clazz.getName()
but some entities,
for example RawData
, have multiple names
BaseException
- If a new instance could not be created.public Object getPropertyValue(DbControl dc, C item, String propertyName) throws BaseException
get
method of the item. Ie.
the following method calls are equivalent:
String name = item.getName(); String name = (String)Metadata.getProperty(item, "name");You can even use dot notation to navigate to associated items:
String quota = item.getOwner().getQuota().getName(); String quota = (String)Metadata.getProperty(item, "owner.quota.name");
TODO - the implementation of this method is a mess. Can it be made more robust?
dc
- The DbControl object used if database access is neededitem
- The item object to get the value from. Null is not allowed.propertyName
- The name of the property to get. Null is not allowed.
BaseException
- If getting the property value goes wrong.
InvalidUseOfNullException
- if any of the required arguments is null.public String toString()
toString
in class Object
|
2.8.3: 2008-10-15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |