org.joor.Reflect Java Examples

The following examples show how to use org.joor.Reflect. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BoundsExtractionTest.java    From androidsvgdrawable-plugin with Apache License 2.0 6 votes vote down vote up
@Test
 public void test() throws IOException, TranscoderException, InstantiationException, IllegalAccessException {
 	// verify bounds
     QualifiedResource svg = qualifiedSVGResourceFactory.fromSVGFile(new File(PATH_IN + filename));
     Rectangle svgBounds = svg.getBounds();
     assertNotNull(svgBounds);
     assertEquals(ceil(expectedWidth), svgBounds.getWidth(), 0);
     assertEquals(ceil(expectedHeight), svgBounds.getHeight(), 0);
     Rectangle svgConstrainedBounds = svg.getScaledBounds(svg.getDensity().getValue());
     assertNotNull(svgConstrainedBounds);
     assertEquals(ceil(constrainedWidth), svgConstrainedBounds.getWidth(), 0);
     assertEquals(ceil(constrainedHeight), svgConstrainedBounds.getHeight(), 0);

     // verify generated png (width, height) for each target density
     final String name = svg.getName();
     for (Density.Value d : Density.Value.values()) {
     	Reflect.on(svg).set("name", name + "_" + d.name());
plugin.transcode(svg, d, new File(PATH_OUT), null);
      BufferedImage image = ImageIO.read(new FileInputStream(new File(PATH_OUT, svg.getName() + "." + OUTPUT_FORMAT.name().toLowerCase())));
Rectangle expectedBounds = svg.getScaledBounds(d);
assertEquals(expectedBounds.getWidth(), image.getWidth(), 0);
      assertEquals(expectedBounds.getHeight(), image.getHeight(), 0);
     }
 }
 
Example #2
Source File: NinePatchMatchingTest.java    From androidsvgdrawable-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void fromJson() throws URISyntaxException, JsonIOException, JsonSyntaxException, IOException {
    try (final Reader reader = new InputStreamReader(new FileInputStream(PATH_IN + fileName))) {
        Type t = new TypeToken<Set<NinePatch>>() {}.getType();
        Set<NinePatch> ninePatchSet = new GsonBuilder().create().fromJson(reader, t);
        NinePatchMap ninePatchMap = NinePatch.init(ninePatchSet);

        QualifiedResource mockedResource = Mockito.mock(QualifiedResource.class);
        Mockito.when(mockedResource.getName()).thenReturn(resourceName);
        Mockito.when(mockedResource.getTypedQualifiers()).thenReturn(typedQualifiers);

        NinePatch ninePatch = ninePatchMap.getBestMatch(mockedResource);
        assertTrue(resultExpected ^ (ninePatch == null));
        if (resultExpected && ninePatch != null) {
        	assertEquals(nameExpected, Reflect.on(ninePatch).get("name"));
        }
    }
}
 
Example #3
Source File: MQAdminExtImpl.java    From rocketmq-exporter with Apache License 2.0 6 votes vote down vote up
@Override
public MessageExt viewMessage(String topic,
                              String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    logger.info("MessageClientIDSetter.getNearlyTimeFromID(msgId)={} msgId={}", MessageClientIDSetter.getNearlyTimeFromID(msgId), msgId);
    try {
        return viewMessage(msgId);
    } catch (Exception e) {
    }
    MQAdminImpl mqAdminImpl = mqClientInstance.getMQAdminImpl();
    QueryResult qr = Reflect.on(mqAdminImpl).call("queryMessage", topic, msgId, 32,
            MessageClientIDSetter.getNearlyTimeFromID(msgId).getTime() - 1000 * 60 * 60 * 13L, Long.MAX_VALUE, true).get();
    if (qr != null && qr.getMessageList() != null && qr.getMessageList().size() > 0) {
        return qr.getMessageList().get(0);
    } else {
        return null;
    }
}
 
Example #4
Source File: JavaSourceLoader.java    From camel-k-runtime with Apache License 2.0 6 votes vote down vote up
@Override
public Result load(Runtime runtime, Source source) throws Exception {
    try (InputStream is = source.resolveAsInputStream(runtime.getCamelContext())) {
        final String content = IOHelper.loadText(is);
        final String name = determineQualifiedName(source, content);
        final Reflect compiled = Reflect.compile(name, content);
        final Object instance = compiled.create().get();

        // The given source may contains additional nested classes which are unknown to Camel
        // as they are associated to the ClassLoader used to compile the source thus we need
        // to add it to the ApplicationContextClassLoader.
        final ClassLoader loader = runtime.getCamelContext().getApplicationContextClassLoader();
        if (loader instanceof CompositeClassloader) {
            ((CompositeClassloader) loader).addClassLoader(instance.getClass().getClassLoader());
        }

        return Result.on(instance);
    }
}
 
Example #5
Source File: RedissonScheduledExecutorServiceTest.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Test
public void testDelay() throws InterruptedException {
    RScheduledExecutorService executor = redisson.getExecutorService("test", ExecutorOptions.defaults().taskRetryInterval(5, TimeUnit.SECONDS));
    long start = System.currentTimeMillis();
    RScheduledFuture<?> f = executor.schedule(new ScheduledCallableTask(), 11, TimeUnit.SECONDS);
    assertThat(f.awaitUninterruptibly(12000)).isTrue();
    assertThat(f.isSuccess()).isTrue();
    assertThat(System.currentTimeMillis() - start).isBetween(11000L, 11500L);
    
    Reflect.onClass(RedissonExecutorService.class).set("RESULT_OPTIONS", RemoteInvocationOptions.defaults().noAck().expectResultWithin(3, TimeUnit.SECONDS));

    executor = redisson.getExecutorService("test", ExecutorOptions.defaults().taskRetryInterval(5, TimeUnit.SECONDS));
    start = System.currentTimeMillis();
    RScheduledFuture<?> f1 = executor.schedule(new ScheduledCallableTask(), 5, TimeUnit.SECONDS);
    assertThat(f1.awaitUninterruptibly(6000)).isTrue();
    assertThat(f1.isSuccess()).isTrue();
    assertThat(System.currentTimeMillis() - start).isBetween(5000L, 5500L);

    start = System.currentTimeMillis();
    RScheduledFuture<?> f2 = executor.schedule(new RunnableTask(), 5, TimeUnit.SECONDS);
    assertThat(f2.awaitUninterruptibly(6000)).isTrue();
    assertThat(f2.isSuccess()).isTrue();
    assertThat(System.currentTimeMillis() - start).isBetween(5000L, 5500L);
}
 
Example #6
Source File: NinePatchGenerationTest.java    From androidsvgdrawable-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void fromJson() throws URISyntaxException, JsonIOException, JsonSyntaxException, IOException, TranscoderException, InstantiationException, IllegalAccessException {
    try (final Reader reader = new InputStreamReader(new FileInputStream(PATH_IN + ninePatchConfig))) {
        Type t = new TypeToken<Set<NinePatch>>() {}.getType();
        Set<NinePatch> ninePatchSet = new GsonBuilder().create().fromJson(reader, t);
        NinePatchMap ninePatchMap = NinePatch.init(ninePatchSet);
        QualifiedResource svg = qualifiedSVGResourceFactory.fromSVGFile(new File(PATH_IN + resourceName));
        NinePatch ninePatch = ninePatchMap.getBestMatch(svg);

        assertNotNull(ninePatch);

        final String name = svg.getName();
    	Reflect.on(svg).set("name", name + "_" + targetDensity.name());
        plugin.transcode(svg, targetDensity, new File(PATH_OUT), ninePatch);
     final File ninePatchFile = new File(PATH_OUT, svg.getName() + ".9." + OUTPUT_FORMAT.name().toLowerCase());
        final File nonNinePatchFile = new File(PATH_OUT, svg.getName() + "." + OUTPUT_FORMAT.name().toLowerCase());

        if (OUTPUT_FORMAT.hasNinePatchSupport()) {
        	assertTrue(FilenameUtils.getName(ninePatchFile.getAbsolutePath()) + " does not exists although the output format supports nine patch", ninePatchFile.exists());
        	assertTrue(FilenameUtils.getName(nonNinePatchFile.getAbsolutePath()) + " file does not exists although the output format supports nine patch", !nonNinePatchFile.exists());
         BufferedImage image = ImageIO.read(new FileInputStream(ninePatchFile));
      tester.test(image);
      // test corner pixels
      int w = image.getWidth();
      int h = image.getHeight();
      new PixelTester(new int[][] {}, new int[][] {
      		{0, 0},
      		{0, h - 1},
      		{w - 1, 0},
      		{w - 1, h - 1}
      }).test(image);
        } else {
        	assertTrue(FilenameUtils.getName(ninePatchFile.getAbsolutePath()) + " exists although the output format does not support nine patch", !ninePatchFile.exists());
        	assertTrue(FilenameUtils.getName(nonNinePatchFile.getAbsolutePath()) + " does not exists although the output format does not support nine patch", nonNinePatchFile.exists());
        }
    }
}
 
Example #7
Source File: CefMessageRouterHandlerProxy.java    From Journey with Apache License 2.0 5 votes vote down vote up
static CefMessageRouterHandlerProxy createHandler(CefMessageRouterHandlerProxy handler) {
    Object instance = Proxy.newProxyInstance(JourneyLoader.getJourneyClassLoader(),
            new Class<?>[]{JourneyLoader.getJourneyClassLoader()
                    .loadClass("org.cef.handler.CefMessageRouterHandler")},
            new Reflect.ProxyInvocationHandler() {
                @Override
                public Object invoke(Object proxy, Method method, Object[] args) {
                    ((Reflect.ProxyArgumentsConverter) Reflect.on(handler).field("PROXY_ARGUMENTS_CONVERTER").get())
                            .convertArguments(method.getName(), args);
                    return ((Reflect.ProxyValueConverter) Reflect.on(handler).field("PROXY_VALUE_CONVERTER").get())
                            .convertValue(method.getName(), Reflect.on(handler).call(method.getName(), args).get());
                }
            });
    return Reflect.on(instance).as(CefMessageRouterHandlerProxy.class);
}
 
Example #8
Source File: JourneySettings.java    From Journey with Apache License 2.0 5 votes vote down vote up
public LogSeverity getLogSeverity() {
    Object realLogSeverity = Reflect.on(cefSettings).get("log_severity");
    if (realLogSeverity == null) {
        return null;
    } else {
        return LogSeverity.valueOf(realLogSeverity.toString());
    }
}
 
Example #9
Source File: CefLifeSpanHandlerProxy.java    From Journey with Apache License 2.0 5 votes vote down vote up
static CefLifeSpanHandlerProxy createHandler(CefLifeSpanHandlerProxy handler) {
    Object instance = Proxy.newProxyInstance(JourneyLoader.getJourneyClassLoader(),
            new Class<?>[]{JourneyLoader.getJourneyClassLoader().loadClass("org.cef.handler.CefLifeSpanHandler")},
            new Reflect.ProxyInvocationHandler() {
                @Override
                public Object invoke(Object proxy, Method method, Object[] args) {
                    ((Reflect.ProxyArgumentsConverter) Reflect.on(handler).field("PROXY_ARGUMENTS_CONVERTER").get())
                            .convertArguments(method.getName(), args);
                    return ((Reflect.ProxyValueConverter) Reflect.on(handler).field("PROXY_VALUE_CONVERTER").get())
                            .convertValue(method.getName(), Reflect.on(handler).call(method.getName(), args).get());
                }
            });
    return Reflect.on(instance).as(CefLifeSpanHandlerProxy.class);
}
 
Example #10
Source File: CompileDependenciesFileGenerator.java    From Phantom with Apache License 2.0 5 votes vote down vote up
private Set<String> getCompileArtifactsForAgp30x() {
    final Set<ArtifactDependencyGraph.HashableResolvedArtifactResult> allArtifacts = Reflect.on("com.android.build.gradle.internal.ide.ArtifactDependencyGraph")
            .call("getAllArtifacts",
                    applicationVariant.getVariantData().getScope(),
                    AndroidArtifacts.ConsumedConfigType.COMPILE_CLASSPATH,
                    null)
            .get();
    return getMavenArtifacts(allArtifacts);
}
 
Example #11
Source File: DeviceChooserDialog.java    From ADB-Duang with MIT License 5 votes vote down vote up
@Override
public JComponent getPreferredFocusedComponent() {
    try {
        return myDeviceChooser.getPreferredFocusComponent();
    } catch (NoSuchMethodError e) {
        // that means that we are probably on a preview version of android studio or in intellij 13
        return Reflect.on(myDeviceChooser).call("getDeviceTable").get();
    }
}
 
Example #12
Source File: GetRequiredHardwareFeaturesCompat.java    From ADBWIFI with Apache License 2.0 5 votes vote down vote up
@Override
// Android studio 1.4 and below
protected EnumSet<IDevice.HardwareFeature> getPreviousImplementation() {
    ManifestInfo manifestInfo = ManifestInfo.get(facet.getModule(), true);
    List<UsesFeature> requiredFeatures = Reflect.on(manifestInfo).call("getRequiredFeatures").get();

    for (UsesFeature feature : requiredFeatures) {
        AndroidAttributeValue<String> name = feature.getName();
        if (name != null && UsesFeature.HARDWARE_TYPE_WATCH.equals(name.getStringValue())) {
            return EnumSet.of(IDevice.HardwareFeature.WATCH);
        }
    }

    return EnumSet.noneOf(IDevice.HardwareFeature.class);
}
 
Example #13
Source File: DeviceChooserDialog.java    From ADBWIFI with Apache License 2.0 5 votes vote down vote up
@Override
public JComponent getPreferredFocusedComponent() {
    try {
        return myDeviceChooser.getPreferredFocusComponent();
    } catch (NoSuchMethodError e) {
        // that means that we are probably on a preview version of android studio or in intellij 13
        return Reflect.on(myDeviceChooser).call("getDeviceTable").get();
    }
}
 
Example #14
Source File: DocumentationProcessorTest.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Test
public void withJavaDoc() throws IOException {
    Reflect.compile(
            "com.linecorp.armeria.WithJavaDoc",
            loadFile("WithJavaDoc.java.txt"),
            new CompileOptions().processors(target)
    );
    testFile("com.linecorp.armeria.WithJavaDoc");
}
 
Example #15
Source File: DocumentationProcessorTest.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Test
public void noJavaDoc() throws IOException {
    Reflect.compile(
            "com.linecorp.armeria.NoJavaDoc",
            loadFile("NoJavaDoc.java.txt"),
            new CompileOptions().processors(target)
    );
    final String fileName = getFileName("com.linecorp.armeria.NoJavaDoc");
    assertThat(Files.notExists(Paths.get(fileName))).isTrue();
}
 
Example #16
Source File: RedissonMapCacheTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Test
public void testDestroy() {
    RMapCache<String, String> cache = redisson.getMapCache("test");
    
    EvictionScheduler evictionScheduler = ((Redisson)redisson).getEvictionScheduler();
    Map<?, ?> map = Reflect.on(evictionScheduler).get("tasks");
    assertThat(map.isEmpty()).isFalse();
    cache.destroy();
    assertThat(map.isEmpty()).isTrue();
}
 
Example #17
Source File: RedissonSetCacheTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Test
public void testDestroy() {
    RSetCache<String> cache = redisson.getSetCache("test");
    
    EvictionScheduler evictionScheduler = ((Redisson)redisson).getEvictionScheduler();
    Map<?, ?> map = Reflect.on(evictionScheduler).get("tasks");
    assertThat(map.isEmpty()).isFalse();
    cache.destroy();
    assertThat(map.isEmpty()).isTrue();
}
 
Example #18
Source File: CookieRepositoryTest.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
private void equals(CookieSet cookieSet, List<Cookie> cookies) {
  assertNotNull(cookieSet);
  assertNotNull(cookies);

  Map<CookieSet.Key, Cookie> map = Reflect.on(cookieSet).field("map").get();
  assertEquals(cookies.size(), map.size());
  for (Cookie cookie: cookies) {
    assertEquals(cookie, map.get(new CookieSet.Key(cookie)));
  }
}
 
Example #19
Source File: CookieRepositoryTest.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Test
public void testUpdate() {
  Context app = RuntimeEnvironment.application;

  HttpUrl urlEh = HttpUrl.parse("http://www.ehviewer.com/");
  Cookie cookieEh1 = new Cookie.Builder()
      .name("level")
      .value("999")
      .domain("www.ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() + 100000)
      .build();
  Cookie cookieEh2 = new Cookie.Builder()
      .name("level")
      .value("0")
      .domain("www.ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() + 100000)
      .build();

  CookieRepository repository = new CookieRepository(app, "cookie.db");
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh1));
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh2));
  Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
  assertEquals(1, map.size());
  equals(map.get("www.ehviewer.com"), Collections.singletonList(cookieEh2));
  repository.close();

  repository = new CookieRepository(app, "cookie.db");
  map = Reflect.on(repository).field("map").get();
  assertEquals(1, map.size());
  equals(map.get("www.ehviewer.com"), Collections.singletonList(cookieEh2));
  repository.close();
}
 
Example #20
Source File: CookieRepositoryTest.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Test
public void testRemoveByExpired() {
  Context app = RuntimeEnvironment.application;

  HttpUrl urlEh = HttpUrl.parse("http://www.ehviewer.com/");
  Cookie cookieEh1 = new Cookie.Builder()
      .name("level")
      .value("999")
      .domain("www.ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() + 100000)
      .build();
  Cookie cookieEh2 = new Cookie.Builder()
      .name("level")
      .value("0")
      .domain("www.ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() - 100000)
      .build();

  CookieRepository repository = new CookieRepository(app, "cookie.db");
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh1));
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh2));
  Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
  assertEquals(1, map.size());
  equals(map.get("www.ehviewer.com"), Collections.<Cookie>emptyList());
  repository.close();

  repository = new CookieRepository(app, "cookie.db");
  map = Reflect.on(repository).field("map").get();
  assertEquals(0, map.size());
  repository.close();
}
 
Example #21
Source File: CookieRepositoryTest.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Test
public void testRemoveByNonPersistent() {
  Context app = RuntimeEnvironment.application;

  HttpUrl urlEh = HttpUrl.parse("http://www.ehviewer.com/");
  Cookie cookieEh1 = new Cookie.Builder()
      .name("level")
      .value("999")
      .domain("www.ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() + 100000)
      .build();
  Cookie cookieEh2 = new Cookie.Builder()
      .name("level")
      .value("0")
      .domain("www.ehviewer.com")
      .path("/")
      .build();

  CookieRepository repository = new CookieRepository(app, "cookie.db");
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh1));
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh2));
  Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
  assertEquals(1, map.size());
  equals(map.get("www.ehviewer.com"), Collections.singletonList(cookieEh2));
  repository.close();


  repository = new CookieRepository(app, "cookie.db");
  map = Reflect.on(repository).field("map").get();
  assertEquals(0, map.size());
  repository.close();
}
 
Example #22
Source File: CookieRepositoryTest.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Test
public void testClear() {
  Context app = RuntimeEnvironment.application;

  HttpUrl url = HttpUrl.parse("http://www.ehviewer.com/");
  Cookie cookie = new Cookie.Builder()
      .name("user")
      .value("1234567890")
      .domain("ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() + 3000)
      .build();

  CookieRepository repository = new CookieRepository(app, "cookie.db");
  repository.saveFromResponse(url, Collections.singletonList(cookie));
  Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
  assertEquals(1, map.size());
  equals(map.get("ehviewer.com"), Collections.singletonList(cookie));
  repository.clear();
  map = Reflect.on(repository).field("map").get();
  assertEquals(0, map.size());
  repository.close();

  repository = new CookieRepository(app, "cookie.db");
  map = Reflect.on(repository).field("map").get();
  assertEquals(0, map.size());
  repository.close();
}
 
Example #23
Source File: AbstractDynamicProvider.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
private Class<?> getRequiredType() {
 	
 		Reflect context = Reflect.on(injector).call("enterContext");
try {
	Dependency<?> dependency = context.call("getDependency").get();
	return dependency.getKey().getTypeLiteral().getRawType();
} finally {
	context.call("close");
}
 }
 
Example #24
Source File: AbstractMethodHandler.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
protected static Object prepareForJava(ODocument result, Class<?> requiredClass) {
	if(result==null) return null;
	else if(requiredClass.isInstance(result)) return result;
	else if(ODocumentWrapper.class.isAssignableFrom(requiredClass)) 
		return Reflect.onClass(requiredClass).create(result).get();
	else if(requiredClass.isInterface())
		return DAO.provide(requiredClass, result);
	else if(result.containsField("value")) {
		Object value = result.field("value");
		if(value instanceof ODocument) return prepareForJava((ODocument)value, requiredClass);
		return result.field("value", requiredClass);
	}
	throw new IllegalStateException("Can't case ODocument to "+requiredClass); 
}
 
Example #25
Source File: AbstractMethodHandler.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
protected static Reflect onRealClass(Class<?> clazz) {
	if(!clazz.isInterface()) return Reflect.onClass(clazz);
	else if(clazz.isAssignableFrom(ArrayList.class)) return Reflect.onClass(ArrayList.class);
	else if(clazz.isAssignableFrom(HashSet.class)) return Reflect.onClass(HashSet.class);
	else if(clazz.isAssignableFrom(HashMap.class)) return Reflect.onClass(HashMap.class);
	return Reflect.onClass(clazz); //Will fail in case of creation of new instance
}
 
Example #26
Source File: DefaultInterfaceMethodHandler.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
public ResultHolder handle(T target, Object proxy, Method method, Object[] args) throws Throwable {
	if(method.isDefault()) {
	Class<?> declaringClass = method.getDeclaringClass();
	MethodHandles.Lookup lookup = Reflect.onClass(MethodHandles.Lookup.class)
			.create(declaringClass, MethodHandles.Lookup.PRIVATE).get();
	return new ResultHolder(lookup.unreflectSpecial(method, declaringClass)
				  .bindTo(proxy)
				  .invokeWithArguments(args));
	} else return null;
}
 
Example #27
Source File: CefJSDialogHandlerProxy.java    From Journey with Apache License 2.0 5 votes vote down vote up
static CefJSDialogHandlerProxy createHandler(CefJSDialogHandlerProxy handler) {
    Object instance = Proxy.newProxyInstance(JourneyLoader.getJourneyClassLoader(),
            new Class<?>[]{JourneyLoader.getJourneyClassLoader().loadClass("org.cef.handler.CefJSDialogHandler")},
            new Reflect.ProxyInvocationHandler() {
                @Override
                public Object invoke(Object proxy, Method method, Object[] args) {
                    ((Reflect.ProxyArgumentsConverter) Reflect.on(handler).field("PROXY_ARGUMENTS_CONVERTER").get())
                            .convertArguments(method.getName(), args);
                    return ((Reflect.ProxyValueConverter) Reflect.on(handler).field("PROXY_VALUE_CONVERTER").get())
                            .convertValue(method.getName(), Reflect.on(handler).call(method.getName(), args).get());
                }
            });
    return Reflect.on(instance).as(CefJSDialogHandlerProxy.class);
}
 
Example #28
Source File: CapsuleTest.java    From capsule with Eclipse Public License 1.0 4 votes vote down vote up
private static boolean runActions(Object capsule, List<String> args) {
    return Reflect.on(capsule.getClass()).call("runActions", capsule, args).get();
}
 
Example #29
Source File: CapsuleTest.java    From capsule with Eclipse Public License 1.0 4 votes vote down vote up
private static String dependencyToLocalJar(Path jar, String dep, String type) {
    clearCaches();
    return Reflect.on(Capsule.class).call("dependencyToLocalJar0", jar, dep, type, null).get();
}
 
Example #30
Source File: CapsuleTest.java    From capsule with Eclipse Public License 1.0 4 votes vote down vote up
private static int main0(Class<?> clazz, String... args) {
    return Reflect.on(clazz).call("main0", (Object) args).get();
}