Java EE 5 SDK

com.sun.appserv.management.util.jmx
Interface AttributeNameMapper

All Known Implementing Classes:
AttributeNameMapperImpl, NoOpAttributeNameMapper

public interface AttributeNameMapper

Maps names to a derived name. An example use for this might be to map a JMX Attribute "foo-bar" to a suiteable "FooBar" form so that it can be used as a Java identifier.


Method Summary
 void addMapping(String originalName, String derivedName)
           
 void deriveAll(String[] originalNames)
          Setup mapping for all specified Attribute names.
 String derivedToOriginal(String derivedName)
          Reverse the effect of originalToDerived()
 void dontMap(String originalName)
          Don't perform any mapping on this name.
 Set<String> getAttributeNames()
          Get the entire set of Attribute names, consisting of the names that were derived, and the names that do not require mapping.
 String matchName(String derivedName, String[] candidates)
          Attempt to match the derived name to one of the candidates.
 String originalToDerived(String originalName)
          Maps Attribute names to another name.
 

Method Detail

addMapping

void addMapping(String originalName,
                String derivedName)
Parameters:
originalName - the original/source/real name of the Attribute
derivedName - the name by which it should be known

dontMap

void dontMap(String originalName)
Don't perform any mapping on this name. Equivalent to calling addMapping( originalName, originalName )

Parameters:
originalName - the "real" name of the Attribute

deriveAll

void deriveAll(String[] originalNames)
Setup mapping for all specified Attribute names. These add to (or replace) any existing mappings.

Parameters:
originalNames - all names from which should be derived names

matchName

String matchName(String derivedName,
                 String[] candidates)
Attempt to match the derived name to one of the candidates. This facility is used when different runtime conditions present different original names which must be mapped to the same derived name.

If a name is matched it is added as a mapping and the original name is returned.


originalToDerived

String originalToDerived(String originalName)
Maps Attribute names to another name.

A common use is to construct legal Java identifiers, so that they can be exposed in an MBean proxy with get/set routines.

For example "classpath-prefix" is not legal in a Java API; it could not generate the methods getclasspath-prefix() and setclasspath-prefix().

Any legal mapping is OK. Suggested possible mappings include: ClasspathPrefix, classpathPrefix, classpath_prefix, etc. These would result in the method names: getClasspathPrefix(), getclasspathPrefix(), getclasspath_prefix(), etc.

Parameters:
originalName - original name

derivedToOriginal

String derivedToOriginal(String derivedName)
Reverse the effect of originalToDerived()

Parameters:
derivedName - name derived from the original one

getAttributeNames

Set<String> getAttributeNames()
Get the entire set of Attribute names, consisting of the names that were derived, and the names that do not require mapping.


Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.