Java EE 5 SDK

com.sun.appserv.management.util.jmx
Class AttributeNameMapperImpl

java.lang.Object
  extended by com.sun.appserv.management.util.jmx.AttributeNameMapperImpl
All Implemented Interfaces:
AttributeNameMapper

public class AttributeNameMapperImpl
extends Object
implements AttributeNameMapper

Maps Attribute names to legal Java identifiers, so that they can be exposed in a proxy with get/set routines


Constructor Summary
AttributeNameMapperImpl()
          Create a new instance which will map nothing by default.
AttributeNameMapperImpl(AttributeNameMangler mangler)
          Create a new instance which will map (as necessary) the specified Attribute names
AttributeNameMapperImpl(String[] originalNames)
          Create a new instance which will map (as necessary) the specified Attribute names.
AttributeNameMapperImpl(String[] originalNames, AttributeNameMangler mangler)
          Create a new instance which will map (as necessary) the specified Attribute names
 
Method Summary
 void addMapping(String originalName, String derivedName)
           
protected  void debug(Object o)
           
 void deriveAll(String[] originalNames)
          Setup mapping for all specified Attribute names.
 boolean derivedSameAsOriginal(String derivedName)
           
 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.
 boolean requiresMapping(String originalName)
           
 void setDebugOutput(Output debugOutput)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeNameMapperImpl

public AttributeNameMapperImpl()
Create a new instance which will map nothing by default.


AttributeNameMapperImpl

public AttributeNameMapperImpl(String[] originalNames)
Create a new instance which will map (as necessary) the specified Attribute names. Same as AttributeNameMapperImpl( originalNames, new AttributeNameManglerImpl() )


AttributeNameMapperImpl

public AttributeNameMapperImpl(AttributeNameMangler mangler)
Create a new instance which will map (as necessary) the specified Attribute names


AttributeNameMapperImpl

public AttributeNameMapperImpl(String[] originalNames,
                               AttributeNameMangler mangler)
Create a new instance which will map (as necessary) the specified Attribute names

Method Detail

setDebugOutput

public void setDebugOutput(Output debugOutput)

debug

protected final void debug(Object o)

matchName

public String matchName(String derivedName,
                        String[] candidates)
Description copied from interface: AttributeNameMapper
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.

Specified by:
matchName in interface AttributeNameMapper

deriveAll

public void deriveAll(String[] originalNames)
Description copied from interface: AttributeNameMapper
Setup mapping for all specified Attribute names. These add to (or replace) any existing mappings.

Specified by:
deriveAll in interface AttributeNameMapper
Parameters:
originalNames - all names from which should be derived names

derivedSameAsOriginal

public boolean derivedSameAsOriginal(String derivedName)

addMapping

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

dontMap

public void dontMap(String originalName)
Description copied from interface: AttributeNameMapper
Don't perform any mapping on this name. Equivalent to calling addMapping( originalName, originalName )

Specified by:
dontMap in interface AttributeNameMapper
Parameters:
originalName - the "real" name of the Attribute

requiresMapping

public boolean requiresMapping(String originalName)

originalToDerived

public String originalToDerived(String originalName)
Description copied from interface: AttributeNameMapper
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.

Specified by:
originalToDerived in interface AttributeNameMapper
Parameters:
originalName - original name

derivedToOriginal

public String derivedToOriginal(String derivedName)
Description copied from interface: AttributeNameMapper
Reverse the effect of originalToDerived()

Specified by:
derivedToOriginal in interface AttributeNameMapper
Parameters:
derivedName - name derived from the original one

getAttributeNames

public Set<String> getAttributeNames()
Description copied from interface: AttributeNameMapper
Get the entire set of Attribute names, consisting of the names that were derived, and the names that do not require mapping.

Specified by:
getAttributeNames in interface AttributeNameMapper

toString

public String toString()
Overrides:
toString in class Object

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.