org.jpox.metadata
Class MetaDataUtils

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

public class MetaDataUtils
extends java.lang.Object

Utilities needed for the processing of MetaData.

Version:
$Revision: 1.39.2.1 $

Field Summary
protected static Localiser LOCALISER
           
 
Constructor Summary
protected MetaDataUtils()
          Protected constructor to prevent outside instantiation
 
Method Summary
static boolean arrayStorableAsByteArrayInSingleColumn(AbstractPropertyMetaData fmd)
          Convenience method to determine if an array is storable in a single column as a byte array.
 java.lang.String[] getImplementationNamesForReferenceField(AbstractPropertyMetaData 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.util.List getOrderedClassNamesFromFileList(java.net.URL[] metaDataFileURLs, java.util.Map classToMetaDataMap)
          Utility to return a list of classes declared in provided metadata files.
 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(AbstractPropertyMetaData fmd, ClassLoaderResolver clr)
          Convenience method that returns if a field stores a First-Class object (FCO).
 
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

getOrderedClassNamesFromFileList

public java.util.List getOrderedClassNamesFromFileList(java.net.URL[] metaDataFileURLs,
                                                       java.util.Map classToMetaDataMap)
                                                throws java.lang.Exception
Utility to return a list of classes declared in provided metadata files. The list of classes are ordered so that all superclasses occur before their subclasses. Additionally populates the provided map with entries mapping the class names to the JDO MetaData file name that the class was found in. Used by SchemaTool.

Parameters:
metaDataFileURLs - The list of JDO metadata file names.
classToMetaDataMap - A Map that will be populated mapping class name to the MetaData file name. This argument can be null.
Returns:
An ordered list of class name strings.
Throws:
java.lang.Exception

arrayStorableAsByteArrayInSingleColumn

public static boolean arrayStorableAsByteArrayInSingleColumn(AbstractPropertyMetaData 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

storesFCO

public boolean storesFCO(AbstractPropertyMetaData fmd,
                         ClassLoaderResolver clr)
Convenience method that returns if a field stores a First-Class object (FCO).

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(AbstractPropertyMetaData 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:
javax.jdo.JDOUserException - if no implementation types are found for the reference type field


Copyright © -2008 . All Rights Reserved.