类 ClassNameGenerator
java.lang.Object
cn.taketoday.aot.generate.ClassNameGenerator
Generate unique class names based on a target
ClassName and a
feature name.
This class is stateful, so the same instance should be used for all name generation.
- 从以下版本开始:
- 4.0
- 作者:
- Phillip Webb, Stephane Nicoll
-
字段概要
字段 -
构造器概要
构造器限定符构造器说明ClassNameGenerator(cn.taketoday.javapoet.ClassName defaultTarget) Create a new instance using the specifieddefaultTargetand no feature name prefix.ClassNameGenerator(cn.taketoday.javapoet.ClassName defaultTarget, String featureNamePrefix) Create a new instance using the specifieddefaultTargetand feature name prefix.privateClassNameGenerator(cn.taketoday.javapoet.ClassName defaultTarget, String featureNamePrefix, Map<String, AtomicInteger> sequenceGenerator) -
方法概要
修饰符和类型方法说明private Stringcn.taketoday.javapoet.ClassNamegenerateClassName(String featureName, cn.taketoday.javapoet.ClassName target) Generate a uniqueClassNamebased on the specifiedfeatureNameandtarget.private cn.taketoday.javapoet.ClassName(专用程序包) Stringprivate StringgetRootName(String featureName, cn.taketoday.javapoet.ClassName target) private static StringtoName(cn.taketoday.javapoet.ClassName className) (专用程序包) ClassNameGeneratorwithFeatureNamePrefix(String featureNamePrefix) Create a newClassNameGeneratorinstance for the specified feature name prefix, keeping track of all the class names generated by this instance.
-
字段详细资料
-
构造器详细资料
-
ClassNameGenerator
public ClassNameGenerator(cn.taketoday.javapoet.ClassName defaultTarget) Create a new instance using the specifieddefaultTargetand no feature name prefix.- 参数:
defaultTarget- the default target class to use
-
ClassNameGenerator
Create a new instance using the specifieddefaultTargetand feature name prefix.- 参数:
defaultTarget- the default target class to usefeatureNamePrefix- the prefix to use to qualify feature names
-
ClassNameGenerator
private ClassNameGenerator(cn.taketoday.javapoet.ClassName defaultTarget, String featureNamePrefix, Map<String, AtomicInteger> sequenceGenerator)
-
-
方法详细资料
-
getFeatureNamePrefix
String getFeatureNamePrefix() -
generateClassName
public cn.taketoday.javapoet.ClassName generateClassName(String featureName, @Nullable cn.taketoday.javapoet.ClassName target) Generate a uniqueClassNamebased on the specifiedfeatureNameandtarget. If thetargetisnull, the configured main target of this instance is used.The class name is a suffixed version of the target. For instance, a
com.example.Demotarget with anInitializerfeature name leads to acom.example.Demo__Initializergenerated class name. The feature name is qualified by the configured feature name prefix, if any.Generated class names are unique. If such a feature was already requested for this target, a counter is used to ensure uniqueness.
- 参数:
featureName- the name of the feature that the generated class supportstarget- the class the newly generated class relates to, ornullto use the main target- 返回:
- a unique generated class name
-
getRootName
-
clean
-
generateSequencedClassName
-
withFeatureNamePrefix
Create a newClassNameGeneratorinstance for the specified feature name prefix, keeping track of all the class names generated by this instance.- 参数:
featureNamePrefix- the feature name prefix to use- 返回:
- a new instance for the specified feature name prefix
-
toName
-