Package org.springframework.beans

Examples of org.springframework.beans.DirectFieldAccessor$FieldAccessor


      template.execute(new SessionCallback<LsEntry, Void>() {

        @Override
        public Void doInSession(Session<LsEntry> session) throws IOException {
          // TODO: avoid DFAs with Spring 4.1 (INT-3412)
          ChannelSftp channel = (ChannelSftp) new DirectFieldAccessor(new DirectFieldAccessor(session)
              .getPropertyValue("targetSession")).getPropertyValue("channel");
          for (int i = 0; i < fileNames.length; i++) {
            try {
              session.remove("si.sftp.sample/" + fileNames[i]);
            }
View Full Code Here


      return template.execute(new SessionCallback<LsEntry, Boolean>() {

        @Override
        public Boolean doInSession(Session<LsEntry> session) throws IOException {
          // TODO: avoid DFAs with Spring 4.1 (INT-3412)
          ChannelSftp channel = (ChannelSftp) new DirectFieldAccessor(new DirectFieldAccessor(session)
              .getPropertyValue("targetSession")).getPropertyValue("channel");
          for (int i = 0; i < fileNames.length; i++) {
            try {
              SftpATTRS stat = channel.stat("si.sftp.sample/" + fileNames[i]);
              if (stat == null) {
View Full Code Here

* @author Gary Russell
*/
public class FileCopyDemoCommon {

  public static void displayDirectories(ApplicationContext context) {
    File inDir = (File) new DirectFieldAccessor(context.getBean(FileReadingMessageSource.class)).getPropertyValue("directory");
    LiteralExpression expression = (LiteralExpression) new DirectFieldAccessor(context.getBean(FileWritingMessageHandler.class)).getPropertyValue("destinationDirectoryExpression");
    File outDir = new File(expression.getValue());
    System.out.println("Input directory is: " + inDir.getAbsolutePath());
    System.out.println("Output directory is: " + outDir.getAbsolutePath());
    System.out.println("===================================================");
  }
View Full Code Here

  /**
   * Create a new DirectFieldAccessor for the underlying target object.
   * @see #getTarget()
   */
  protected DirectFieldAccessor createDirectFieldAccessor() {
    return new DirectFieldAccessor(getTarget());
  }
View Full Code Here

    @Override
    public Object createdEndpoint(ServerEndpointRegistration registration, ComponentProviderService provider,
        WebSocketContainer container, TyrusWebSocketEngine engine) throws DeploymentException {

      DirectFieldAccessor accessor = new DirectFieldAccessor(engine);
      Object sessionListener = accessor.getPropertyValue("sessionListener");
      Object clusterContext = accessor.getPropertyValue("clusterContext");
      try {
        return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
            "/",  registration.getConfigurator(), sessionListener, clusterContext, null);
      }
      catch (Exception ex) {
View Full Code Here

    this.webSocketHandler.afterConnectionEstablished(session2);
    session1.setOpen(true);
    session2.setOpen(true);

    long sixtyOneSecondsAgo = System.currentTimeMillis() - 61 * 1000;
    new DirectFieldAccessor(this.webSocketHandler).setPropertyValue("lastSessionCheckTime", sixtyOneSecondsAgo);
    Map<String, ?> sessions = (Map<String, ?>) new DirectFieldAccessor(this.webSocketHandler).getPropertyValue("sessions");
    new DirectFieldAccessor(sessions.get("id1")).setPropertyValue("createTime", sixtyOneSecondsAgo);
    new DirectFieldAccessor(sessions.get("id2")).setPropertyValue("createTime", sixtyOneSecondsAgo);

    this.webSocketHandler.start();
    this.webSocketHandler.handleMessage(session1, new TextMessage("foo"));

    assertTrue(session1.isOpen());
View Full Code Here

  @Test
  public void defaultLifecycleProcessorInstance() {
    StaticApplicationContext context = new StaticApplicationContext();
    context.refresh();
    Object lifecycleProcessor = new DirectFieldAccessor(context).getPropertyValue("lifecycleProcessor");
    assertNotNull(lifecycleProcessor);
    assertEquals(DefaultLifecycleProcessor.class, lifecycleProcessor.getClass());
  }
View Full Code Here

    beanDefinition.getPropertyValues().addPropertyValue("timeoutPerShutdownPhase", 1000);
    StaticApplicationContext context = new StaticApplicationContext();
    context.registerBeanDefinition("lifecycleProcessor", beanDefinition);
    context.refresh();
    LifecycleProcessor bean = context.getBean("lifecycleProcessor", LifecycleProcessor.class);
    Object contextLifecycleProcessor = new DirectFieldAccessor(context).getPropertyValue("lifecycleProcessor");
    assertNotNull(contextLifecycleProcessor);
    assertSame(bean, contextLifecycleProcessor);
    assertEquals(1000L, new DirectFieldAccessor(contextLifecycleProcessor).getPropertyValue(
        "timeoutPerShutdownPhase"));
  }
View Full Code Here

    context.registerBeanDefinition("target", targetDefinition);
    context.refresh();
    Object postProcessor = context.getBean("postProcessor");
    Object target = context.getBean("target");
    ScheduledTaskRegistrar registrar = (ScheduledTaskRegistrar)
        new DirectFieldAccessor(postProcessor).getPropertyValue("registrar");
    @SuppressWarnings("unchecked")
    List<IntervalTask> fixedDelayTasks = (List<IntervalTask>)
        new DirectFieldAccessor(registrar).getPropertyValue("fixedDelayTasks");
    assertEquals(1, fixedDelayTasks.size());
    IntervalTask task = fixedDelayTasks.get(0);
    ScheduledMethodRunnable runnable = (ScheduledMethodRunnable) task.getRunnable();
    Object targetObject = runnable.getTarget();
    Method targetMethod = runnable.getMethod();
View Full Code Here

    context.registerBeanDefinition("target", targetDefinition);
    context.refresh();
    Object postProcessor = context.getBean("postProcessor");
    Object target = context.getBean("target");
    ScheduledTaskRegistrar registrar = (ScheduledTaskRegistrar)
        new DirectFieldAccessor(postProcessor).getPropertyValue("registrar");
    @SuppressWarnings("unchecked")
    List<IntervalTask> fixedRateTasks = (List<IntervalTask>)
        new DirectFieldAccessor(registrar).getPropertyValue("fixedRateTasks");
    assertEquals(1, fixedRateTasks.size());
    IntervalTask task = fixedRateTasks.get(0);
    ScheduledMethodRunnable runnable = (ScheduledMethodRunnable) task.getRunnable();
    Object targetObject = runnable.getTarget();
    Method targetMethod = runnable.getMethod();
View Full Code Here

TOP

Related Classes of org.springframework.beans.DirectFieldAccessor$FieldAccessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.