com.google.inject.grapher
Class ShortNameFactory

java.lang.Object
  extended by com.google.inject.grapher.ShortNameFactory
All Implemented Interfaces:
NameFactory

public class ShortNameFactory
extends Object
implements NameFactory

Reasonable implementation for NameFactory. Mostly takes various Object.toString()s and strips package names out of them so that they'll fit on the graph.

Author:
phopkins@gmail.com (Pete Hopkins)

Constructor Summary
ShortNameFactory()
           
 
Method Summary
 String getAnnotationName(Key<?> key)
           
 String getClassName(Key<?> key)
           
protected  String getFileString(StackTraceElement stackTraceElement)
           
 String getInstanceName(Object instance)
           
 String getMemberName(Member member)
           
protected  String getMethodString(Method method)
           
 String getSourceName(Object source)
          Returns a name for a Guice "source" object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShortNameFactory

public ShortNameFactory()
Method Detail

getMemberName

public String getMemberName(Member member)
Specified by:
getMemberName in interface NameFactory

getAnnotationName

public String getAnnotationName(Key<?> key)
Specified by:
getAnnotationName in interface NameFactory

getClassName

public String getClassName(Key<?> key)
Specified by:
getClassName in interface NameFactory

getInstanceName

public String getInstanceName(Object instance)
Specified by:
getInstanceName in interface NameFactory

getSourceName

public String getSourceName(Object source)
Returns a name for a Guice "source" object. This will typically be either a StackTraceElement for when the binding is made to the instance, or a Method when a provider method is used.

Specified by:
getSourceName in interface NameFactory

getFileString

protected String getFileString(StackTraceElement stackTraceElement)

getMethodString

protected String getMethodString(Method method)


Copyright © 2006-2011 Google, Inc.. All Rights Reserved.