com.sun.jini.reggie
Class ClassMapper

java.lang.Object
  extended by com.sun.jini.reggie.ClassMapper

 class ClassMapper
extends Object

Maps Class to ServiceType/Base, Class to EntryClass/Base, and Class to Field[], with caching for efficiency.

Author:
Sun Microsystems, Inc.

Nested Class Summary
(package private) static class ClassMapper.EntryField
          Field of an Entry class, with marshalling information
private static class ClassMapper.FieldComparator
          Comparator for sorting fields.
 
Field Summary
private static ClassMapper.FieldComparator comparator
          Comparator for sorting fields
private static ServiceType[] empty
           
private static WeakHashMap entryMap
          Weak Map from Class to SoftReference(EntryClassBase)
private static WeakHashMap fieldMap
          Weak Map from Class to SoftReference(sorted Field[])
private static Class[] noArg
           
private static WeakHashMap serviceMap
          Weak Map from Class to SoftReference(ServiceTypeBase)
 
Constructor Summary
private ClassMapper()
           
 
Method Summary
static ClassMapper.EntryField[] getFields(Class cls)
          Returns public fields, in super to subclass order, sorted alphabetically within a given class.
private static EntryClass toEntryClass(Class cls)
          Returns an EntryClass descriptor for a class.
static EntryClassBase toEntryClassBase(Class cls)
          Returns a EntryClassBase descriptor for a class.
private static EntryClassBase toEntryClassBase(Class cls, boolean base)
          Returns a EntryClassBase descriptor for a class.
private static ServiceType toServiceType(Class cls)
          Returns a ServiceType descriptor for a class.
static ServiceType[] toServiceType(Class[] classes)
          Converts an array of Class to an array of ServiceType.
static ServiceTypeBase toServiceTypeBase(Class cls)
          Returns a ServiceTypeBase descriptor for a class.
private static ServiceTypeBase toServiceTypeBase(Class cls, boolean needCodebase)
          Returns a ServiceTypeBase descriptor for a class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serviceMap

private static final WeakHashMap serviceMap
Weak Map from Class to SoftReference(ServiceTypeBase)


entryMap

private static final WeakHashMap entryMap
Weak Map from Class to SoftReference(EntryClassBase)


fieldMap

private static final WeakHashMap fieldMap
Weak Map from Class to SoftReference(sorted Field[])


comparator

private static final ClassMapper.FieldComparator comparator
Comparator for sorting fields


empty

private static final ServiceType[] empty

noArg

private static final Class[] noArg
Constructor Detail

ClassMapper

private ClassMapper()
Method Detail

toServiceTypeBase

public static ServiceTypeBase toServiceTypeBase(Class cls)
                                         throws MarshalException
Returns a ServiceTypeBase descriptor for a class.

Throws:
MarshalException

toServiceTypeBase

private static ServiceTypeBase toServiceTypeBase(Class cls,
                                                 boolean needCodebase)
                                          throws MarshalException
Returns a ServiceTypeBase descriptor for a class. If needCodebase is false, the returned descriptor's codebase may be null.

Throws:
MarshalException

toServiceType

private static ServiceType toServiceType(Class cls)
                                  throws MarshalException
Returns a ServiceType descriptor for a class.

Throws:
MarshalException

toServiceType

public static ServiceType[] toServiceType(Class[] classes)
                                   throws MarshalException
Converts an array of Class to an array of ServiceType.

Throws:
MarshalException

toEntryClassBase

public static EntryClassBase toEntryClassBase(Class cls)
                                       throws MarshalException
Returns a EntryClassBase descriptor for a class.

Throws:
MarshalException

toEntryClassBase

private static EntryClassBase toEntryClassBase(Class cls,
                                               boolean base)
                                        throws MarshalException
Returns a EntryClassBase descriptor for a class. If base is false, the returned descriptor's codebase may be null, and the class need not be public and need not have a no-arg constructor.

Throws:
MarshalException

toEntryClass

private static EntryClass toEntryClass(Class cls)
                                throws MarshalException
Returns an EntryClass descriptor for a class.

Throws:
MarshalException

getFields

public static ClassMapper.EntryField[] getFields(Class cls)
Returns public fields, in super to subclass order, sorted alphabetically within a given class.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.