本文整理汇总了Java中com.apple.internal.jobjc.generator.utils.JavaLang.JLMethod类的典型用法代码示例。如果您正苦于以下问题:Java JLMethod类的具体用法?Java JLMethod怎么用?Java JLMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JLMethod类属于com.apple.internal.jobjc.generator.utils.JavaLang包,在下文中一共展示了JLMethod类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createFieldCache
import com.apple.internal.jobjc.generator.utils.JavaLang.JLMethod; //导入依赖的package包/类
private static String createFieldCache(final Class<? extends Invoke> type, final Function fxn) {
final String identifier = makeInstanceName(fxn);
JLField field = new JLField("private static", type.getCanonicalName(), identifier);
// It's okay to make it static, because the getter isn't static, so the only way to access it is through an instance.
JLMethod getter = new JLMethod("private final", type.getCanonicalName(), "get_" + identifier);
JLCall createIt = new JLCall("new " + type.getCanonicalName());
createIt.args.add(firstArg(fxn));
createIt.args.add("\"" + fxn.name + "\"");
createIt.args.add(fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName());
for (final Arg arg : fxn.args)
createIt.args.add(arg.type.getJType().getCoderDescriptor().getCoderInstanceName());
getter.body.add("return " + new JLTertiary(identifier + " != null", identifier, identifier + " = " + createIt) + ";");
return field.toString() + getter.toString();
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:FunctionGenerator.java
示例2: writeBeginning
import com.apple.internal.jobjc.generator.utils.JavaLang.JLMethod; //导入依赖的package包/类
@Override public void writeBeginning(final PrintStream out) {
out.print(new JLField("private static", JOBJC_CLASSNAME, "instance"));
out.print(new JLField("private final", JObjCRuntime.class.getName(), "runtime"));
JLMethod getInstR = new JLMethod("public static", JOBJC_CLASSNAME, "getInstance", "final JObjCRuntime runtime");
getInstR.body.add("if(runtime == null) throw new NullPointerException(\"runtime\");");
getInstR.body.add("if(instance == null) instance = new JObjC(runtime);");
getInstR.body.add("return instance;");
out.print(getInstR);
JLMethod getInst = new JLMethod("public static", JOBJC_CLASSNAME, "getInstance");
getInst.body.add("return getInstance(JObjCRuntime.getInstance());");
out.print(getInst);
JLCtor ctor = new JLCtor("private", JOBJC_CLASSNAME, "final JObjCRuntime runtime");
ctor.body.add("this.runtime = runtime;");
for (final Framework f : frameworks)
ctor.body.add("runtime.registerPackage(\"" + f.pkg + "\");");
out.print(ctor);
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:RootJObjCClass.java
注:本文中的com.apple.internal.jobjc.generator.utils.JavaLang.JLMethod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论