本文整理汇总了Java中com.apple.internal.jobjc.generator.Utils.Substituter类的典型用法代码示例。如果您正苦于以下问题:Java Substituter类的具体用法?Java Substituter怎么用?Java Substituter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Substituter类属于com.apple.internal.jobjc.generator.Utils包,在下文中一共展示了Substituter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeSingleton
import com.apple.internal.jobjc.generator.Utils.Substituter; //导入依赖的package包/类
public static String makeSingleton(final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
return generateSingleton(new Substituter(
"#private $CLASS $IVAR = null;~" +
"#public $CLASS $METHOD() {~" +
"##return $IVAR != null ? $IVAR : ($IVAR = new $CLASS($CTORARGS));~" +
"#}~"),
instanceVariable, methodName, className, constructorArgs);
}
示例2: makeStaticSingleton
import com.apple.internal.jobjc.generator.Utils.Substituter; //导入依赖的package包/类
public static String makeStaticSingleton(final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
return generateSingleton(new Substituter(
"#private static $CLASS $IVAR = null;~" +
"#public static $CLASS $METHOD() {~" +
"##return $IVAR != null ? $IVAR : ($IVAR = new $CLASS($CTORARGS));~" +
"#}~"),
instanceVariable, methodName, className, constructorArgs);
}
示例3: generateSingleton
import com.apple.internal.jobjc.generator.Utils.Substituter; //导入依赖的package包/类
private static String generateSingleton(final Substituter singleton, final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
singleton.replace("IVAR", instanceVariable);
singleton.replace("METHOD", methodName);
singleton.replace("CLASS", className);
singleton.replace("CTORARGS", Utils.joinWComma(constructorArgs));
return singleton.toString();
}