Package com.google.inject.grapher
Class ShortNameFactory
java.lang.Object
com.google.inject.grapher.ShortNameFactory
- All Implemented Interfaces:
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.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAnnotationName(Key<?> key) getClassName(Key<?> key) protected StringgetFileString(StackTraceElement stackTraceElement) getInstanceName(Object instance) getMemberName(Member member) protected StringgetMethodString(Method method) getSourceName(Object source) Returns a name for a Guice "source" object.private StringstripPackages(String str) Eliminates runs of lowercase characters and numbers separated by periods.
-
Constructor Details
-
ShortNameFactory
public ShortNameFactory()
-
-
Method Details
-
getMemberName
- Specified by:
getMemberNamein interfaceNameFactory
-
getAnnotationName
- Specified by:
getAnnotationNamein interfaceNameFactory
-
getClassName
- Specified by:
getClassNamein interfaceNameFactory
-
getInstanceName
- Specified by:
getInstanceNamein interfaceNameFactory
-
getSourceName
Returns a name for a Guice "source" object. This will typically be either aStackTraceElementfor when the binding is made to the instance, or aMethodwhen a provider method is used.- Specified by:
getSourceNamein interfaceNameFactory
-
getFileString
-
getMethodString
-
stripPackages
Eliminates runs of lowercase characters and numbers separated by periods. Seems to remove packages from fully-qualified type names pretty well.
-