public class Metadata<C> extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Metadata.BasicData2ItemPropertyPath<C extends BasicData,V extends BasicItem<C>>
Property path implementation that converts a BasicData object
to a BasicItem.
|
(package private) static class |
Metadata.BasicItem2DataPropertyPath<C extends BasicItem<V>,V extends BasicData>
Property path implementation that converts a BasicItem to a BasicData
object.
|
(package private) static class |
Metadata.CollectionPropertyPath<C>
Property path implementation which wraps a collection inside an unmodifiable
collection.
|
(package private) static class |
Metadata.CombinedPropertyPath<C,V>
Property path implementation that combines a list of property paths
to create a long chain.
|
(package private) static class |
Metadata.ComponentPropertyPath<C,V>
Property path implementation which gets a value from a component.
|
(package private) static class |
Metadata.DateCopyPropertyPath
Property path implementation clones a Date.
|
(package private) static class |
Metadata.EntityPropertyPath<C,V>
Property path implementation which gets a value from an entity.
|
(package private) static class |
Metadata.EvictPropertyPath<C>
Property path implementation that evicts the selected item from
the Hibernate first-level cache.
|
(package private) static class |
Metadata.IdentifierPropertyPath
Property path implementation which gets the id from an entity.
|
(package private) static class |
Metadata.MapPropertyPath
Property path implementation which wraps a map inside an unmodifiable
map.
|
(package private) static class |
Metadata.NoopPropertyPath<C>
Property path implementation that does nothing.
|
static interface |
Metadata.PropertyPath<C,V>
Contract for getting the value of a specific property for an item.
|
(package private) static class |
Metadata.ReporterScore2DataPropertyPath
Property path implementation that converts a ReporterScore to a ReporterListScoreData
object.
|
Modifier and Type | Field and Description |
---|---|
private static Set<Item> |
annotatableItems |
private Map<String,Metadata.PropertyPath> |
cachedPaths |
private ClassMetadata |
classMetadata |
private Class<C> |
clazz |
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 |
private static Set<Item> |
subtypableItems |
Modifier | Constructor and Description |
---|---|
private |
Metadata(Class<C> clazz,
String entityName) |
Modifier and Type | Method and Description |
---|---|
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. |
private int |
getIndex(String s,
String[] list,
Comparator<String> check) |
static <I> Metadata<I> |
getInstance(Class<I> itemClass)
Get the metadata instance for the specified type of item.
|
static <I> Metadata<I> |
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. |
<V> Metadata.PropertyPath<C,V> |
getPropertyPath(String path,
boolean ignoreCase)
Get a property path that can be used to retrieve a value
from an item instead of using the regular
get
methods. |
static Set<Item> |
getRemovableItems()
Get a set containing all
Removable item types. |
static Set<Item> |
getShareableItems()
Get a set containing all
Shareable item types. |
static Set<Item> |
getSubtypableItems()
Get a set containing all
Subtypable item types. |
(package private) static void |
init() |
String |
toString() |
(package private) static void |
unload()
Unload all settings.
|
private static boolean isInitialised
private static final Map<String,Metadata<?>> instances
private final ClassMetadata classMetadata
private final String entityName
private final Map<String,Metadata.PropertyPath> cachedPaths
private Metadata(Class<C> clazz, String entityName) throws BaseException
BaseException
static void init()
static void unload()
private 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 Set<Item> getSubtypableItems()
Subtypable
item types.
The set cannot be modified.public static <I> Metadata<I> getInstance(Class<I> itemClass) throws BaseException
I
- itemClass
- The class of the itemBaseException
- 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 namesBaseException
- If a new instance could not be created.public <V> Metadata.PropertyPath<C,V> getPropertyPath(String path, boolean ignoreCase)
get
methods. The following method calls are equivalent:
// Using getter method String name = item.getName(); // Using PropertyPath PropertyPath path = metadata.getPropertyPath("name"); String name = (String)path.getValue(dc, item);You can even use dot notation to navigate to associated items:
// Using getter methods String quota = item.getOwner().getQuota().getName(); // Using PropertyPath PropertyPath path = metadata.getPropertyPath("owner.quota.name"); String quota = (String)path.getValue(dc, item);
V
- The class of the returned valuespath
- The name of the property to get. Null is not allowed. Use
. or # as a separator between property and association namesNullPointerException
- If the path is nullInvalidDataException
- If the path is not a valid pathprivate int getIndex(String s, String[] list, Comparator<String> check)