cf.setSourceFile(QuickConstructorGenerator.class.getName()); cf.setTarget("1.5"); cf.addInterface(factory); cf.markSynthetic(); cf.addDefaultConstructor();
private Class<T> createWrapper() { RuntimeClassFile cf = new RuntimeClassFile(mType.getName()); cf.addInterface(mType); cf.markSynthetic(); cf.setSourceFile(BelatedCreator.class.getName());
private Class<?> generateClass(ScoreFormulaLexer lexer, int funcNum) throws Exception { // initialize the code generator RuntimeClassFile cf = new RuntimeClassFile("UserDefinedFunction_"+funcNum); cf.addInterface("com.flaptor.indextank.index.scorer.ScoreFunction"); cf.addDefaultConstructor(); docVarType = TypeDesc.forClass("com.flaptor.indextank.index.scorer.Boosts"); // DocVariables queryVarType = TypeDesc.forClass("com.flaptor.indextank.query.QueryVariables"); // Variables params = new TypeDesc[] {TypeDesc.DOUBLE, TypeDesc.INT, docVarType, queryVarType}; MethodInfo mi = cf.addMethod(Modifiers.PUBLIC, "score", TypeDesc.DOUBLE, params); b = new CodeBuilder(mi); scoreParam = b.getParameter(0); ageParam = b.getParameter(1); docVarParam = b.getParameter(2); queryVarParam = b.getParameter(3); // parse and generate code start(); error = error == null ? lexer.getError() : error; if (null != error) { throw error; } // return the generated class Class<?> clazz = cf.defineClass(); return clazz; }
cf.addInterface(Comparator.class); cf.addInterface(Serializable.class);
cf.setSourceFile(QuickConstructorGenerator.class.getName()); cf.setTarget("1.5"); cf.addInterface(factory); cf.markSynthetic(); cf.addDefaultConstructor();
cf.addInterface(Remote.class); TypeDesc exType = TypeDesc.forClass(RemoteException.class); cf.addInterface(iface);
cf.setTarget("1.5"); if (baseType.isInterface()) { cf.addInterface(baseType);
cf.addInterface("E".equals(type) ? Externalizable.class : Serializable.class); cf.addInterface(interfaceName);
private Class<T> createWrapper() { RuntimeClassFile cf = new RuntimeClassFile(mType.getName()); cf.addInterface(mType); cf.markSynthetic(); cf.setSourceFile(BelatedCreator.class.getName());
cf.setTarget("1.5"); cf.addInterface(Comparator.class); cf.addInterface(Serializable.class);
private Class<? extends Skeleton> generateSkeleton() { RuntimeClassFile cf = createRuntimeClassFile(mType.getName() + "$Skeleton", mType.getClassLoader()); cf.addInterface(Skeleton.class); cf.setSourceFile(SkeletonFactoryGenerator.class.getName()); cf.markSynthetic();
private Class<? extends R> generateStub() { RuntimeClassFile cf = createRuntimeClassFile(mRemoteInfo.getName() + "$Stub", mType.getClassLoader()); cf.addInterface(mType); cf.addInterface(Stub.class); cf.setSourceFile(StubFactoryGenerator.class.getName()); cf.markSynthetic();