All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.alfasoftware.astra.example.ExampleUseCase Maven / Gradle / Ivy

Go to download

Astra is a Java tool for analysing and refactoring Java source code. This module contains example uses.

There is a newer version: 2.4.2
Show newest version
package org.alfasoftware.astra.example;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import org.alfasoftware.astra.core.matchers.MethodMatcher;
import org.alfasoftware.astra.core.refactoring.UseCase;
import org.alfasoftware.astra.core.refactoring.operations.methods.MethodInvocationRefactor;
import org.alfasoftware.astra.core.utils.ASTOperation;

public class ExampleUseCase implements UseCase {

  @Override
  public Set getOperations() {
    return new HashSet<>(
      Arrays.asList(
        MethodInvocationRefactor
          .from(
            MethodMatcher.builder()
              .withFullyQualifiedDeclaringType("org.alfasoftware.astra.example.target.FooBarInterface")
              .withMethodName("doFoo")
              .build())
          .to(
            new MethodInvocationRefactor.Changes().toNewMethodName("doBar"))
      )
    );
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy