org.sonar.api.component
Interface ResourcePerspectives

All Superinterfaces:
BatchComponent, Perspectives, ServerComponent

public interface ResourcePerspectives
extends Perspectives

Use this component to create perspective from resources or InputPath Only on batch-side.

 public class MySensor implements Sensor {
   private final ResourcePerspectives perspectives;

   public MySensor(ResourcePerspectives perspectives) {
     this.perspectives = perspectives;
   }
   
   public void analyse(Project module, SensorContext context) {
      // Get some Resource or InputFile/InputPath
      Highlightable highlightable = perspectives.as(Highlightable.class, inputPath);
      if (highlightable != null) {
        ...
      }
   }
 }
 

Since:
3.5
See Also:
Issuable, Highlightable, Symbolizable, Testable, TestPlan

Method Summary
<P extends Perspective>
P
as(Class<P> perspectiveClass, InputPath inputPath)
          Allow to create perspective from InputPath.
<P extends Perspective>
P
as(Class<P> perspectiveClass, Resource resource)
           
 
Methods inherited from interface org.sonar.api.component.Perspectives
as
 

Method Detail

as

@CheckForNull
<P extends Perspective> P as(Class<P> perspectiveClass,
                                          Resource resource)

as

@CheckForNull
<P extends Perspective> P as(Class<P> perspectiveClass,
                                          InputPath inputPath)
Allow to create perspective from InputPath. In particular from InputFile.

Since:
4.5.2


Copyright © 2009–2015 SonarSource. All rights reserved.