Java源码示例:com.apple.internal.jobjc.generator.model.Function

示例1
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();
}
 
示例2
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例3
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();
}
 
示例4
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例5
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();
}
 
示例6
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例7
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例8
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();
}
 
示例9
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例10
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();
}
 
示例11
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例12
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();
}
 
示例13
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例14
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();
}
 
示例15
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例16
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();
}
 
示例17
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例18
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();
}
 
示例19
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例20
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();
}
 
示例21
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例22
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();
}
 
示例23
private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
    final String identifier = makeInstanceName(fxn);
    StringWriter out = new StringWriter();

    out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));

    for(int i = 0; i < fxn.args.size(); i++)
        out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));

    if(fxn.variadic){
        out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
        out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
    }

    out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
            + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");

    return out.toString();
}
 
示例24
private static String makeInstanceName(Function fxn){
    String ext;
    if(fxn instanceof Method){
        if(((Method) fxn).isClassMethod) ext = "CMetInst";
        else                             ext = "IMetInst";
    }
    else
        ext = "FxnInst";

    return fxn.getJavaName() + "_" + ext;
}
 
示例25
private static String makeInstanceName(Function fxn){
    String ext;
    if(fxn instanceof Method){
        if(((Method) fxn).isClassMethod) ext = "CMetInst";
        else                             ext = "IMetInst";
    }
    else
        ext = "FxnInst";

    return fxn.getJavaName() + "_" + ext;
}
 
示例26
private static String makeInstanceName(Function fxn){
    String ext;
    if(fxn instanceof Method){
        if(((Method) fxn).isClassMethod) ext = "CMetInst";
        else                             ext = "IMetInst";
    }
    else
        ext = "FxnInst";

    return fxn.getJavaName() + "_" + ext;
}
 
示例27
private static String makeInstanceName(Function fxn){
    String ext;
    if(fxn instanceof Method){
        if(((Method) fxn).isClassMethod) ext = "CMetInst";
        else                             ext = "IMetInst";
    }
    else
        ext = "FxnInst";

    return fxn.getJavaName() + "_" + ext;
}
 
示例28
private static String makeInstanceName(Function fxn){
    String ext;
    if(fxn instanceof Method){
        if(((Method) fxn).isClassMethod) ext = "CMetInst";
        else                             ext = "IMetInst";
    }
    else
        ext = "FxnInst";

    return fxn.getJavaName() + "_" + ext;
}
 
示例29
private static String makeInstanceName(Function fxn){
    String ext;
    if(fxn instanceof Method){
        if(((Method) fxn).isClassMethod) ext = "CMetInst";
        else                             ext = "IMetInst";
    }
    else
        ext = "FxnInst";

    return fxn.getJavaName() + "_" + ext;
}
 
示例30
private static String makeInstanceName(Function fxn){
    String ext;
    if(fxn instanceof Method){
        if(((Method) fxn).isClassMethod) ext = "CMetInst";
        else                             ext = "IMetInst";
    }
    else
        ext = "FxnInst";

    return fxn.getJavaName() + "_" + ext;
}