org.datanucleus.metadata
Class MetaDataUtils

java.lang.Object
  extended by org.datanucleus.metadata.MetaDataUtils

public class MetaDataUtils
extends java.lang.Object

Utilities needed for the processing of MetaData.

Version:
$Revision: 1.49 $

Field Summary
protected static Localiser LOCALISER
           
 
Constructor Summary
protected MetaDataUtils()
          Protected constructor to prevent outside instantiation
 
Method Summary
 boolean arrayStorableAsByteArrayInSingleColumn(AbstractMemberMetaData fmd)
          Convenience method to determine if an array is storable in a single column as a byte array.
 java.lang.String[] getImplementationNamesForReferenceField(AbstractMemberMetaData fmd, int fieldRole, ClassLoaderResolver clr)
          Convenience method to return the class names of the available implementation types for an interface/Object field, given its required role.
static MetaDataUtils getInstance()
          Gets an instance of MetaDataUtils
 java.lang.String[] getValuesForCommaSeparatedAttribute(java.lang.String attr)
          Convenience method that splits a comma-separated list of values into a String array (removing whitespace).
 boolean storesFCO(AbstractMemberMetaData fmd, ClassLoaderResolver clr)
          Convenience method that returns if a field stores a First-Class object (FCO).
 boolean storesPersistable(AbstractMemberMetaData fmd, ClassLoaderResolver clr)
          Convenience method that returns if a field stores a persistable object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Constructor Detail

MetaDataUtils

protected MetaDataUtils()
Protected constructor to prevent outside instantiation

Method Detail

getInstance

public static MetaDataUtils getInstance()
Gets an instance of MetaDataUtils

Returns:
a singleton instance of MetaDataUtils

arrayStorableAsByteArrayInSingleColumn

public boolean arrayStorableAsByteArrayInSingleColumn(AbstractMemberMetaData fmd)
Convenience method to determine if an array is storable in a single column as a byte array.

Parameters:
fmd - The field
Returns:
Whether this is an array that can be stored in a single column as non-serialised

storesPersistable

public boolean storesPersistable(AbstractMemberMetaData fmd,
                                 ClassLoaderResolver clr)
Convenience method that returns if a field stores a persistable object. Doesn't care if the persistable object is serialised or embedded, just that it is persistable.

Parameters:
fmd - MetaData for the field
clr - ClassLoaderResolver resolver
Returns:
Whether it stores a persistable object

storesFCO

public boolean storesFCO(AbstractMemberMetaData fmd,
                         ClassLoaderResolver clr)
Convenience method that returns if a field stores a First-Class object (FCO). If a field object is serialised/embedded then doesn't count the object as FCO - use storesPersistable() if you want that not checking.

Parameters:
fmd - MetaData for the field
clr - ClassLoaderResolver resolver
Returns:
Whether it stores a FCO

getValuesForCommaSeparatedAttribute

public java.lang.String[] getValuesForCommaSeparatedAttribute(java.lang.String attr)
Convenience method that splits a comma-separated list of values into a String array (removing whitespace).

Parameters:
attr - The attribute value
Returns:
The string components

getImplementationNamesForReferenceField

public java.lang.String[] getImplementationNamesForReferenceField(AbstractMemberMetaData fmd,
                                                                  int fieldRole,
                                                                  ClassLoaderResolver clr)
Convenience method to return the class names of the available implementation types for an interface/Object field, given its required role. Removes all duplicates from the list.

Parameters:
fmd - MetaData for the field
fieldRole - The role of the field
clr - the ClassLoaderResolver
Returns:
Names of the classes of the possible implementations of this interface/Object
Throws:
NucleusUserException - if no implementation types are found for the reference type field


Copyright © 2009. All Rights Reserved.