Class Cs.IndexerDeclaration

java.lang.Object
org.openrewrite.csharp.tree.Cs.IndexerDeclaration
All Implemented Interfaces:
Cs, org.openrewrite.java.tree.J, org.openrewrite.java.tree.Statement, org.openrewrite.java.tree.TypedTree, org.openrewrite.Tree
Enclosing interface:
Cs

public static final class Cs.IndexerDeclaration extends Object implements Cs, org.openrewrite.java.tree.Statement, org.openrewrite.java.tree.TypedTree
Represents a C# indexer declaration which allows objects to be indexed like arrays.
 // Simple indexer
 public int this[int index] { get { } set { } }

 // Indexer with multiple parameters
 public string this[int x, int y] { get; set; }

 // Readonly indexer
 public MyType this[string key] { get; }

 // Interface indexer
 string this[int index] { get; set; }

 // Protected indexer with expression body
 protected internal int this[int i] => array[i];
 
  • Constructor Details

    • IndexerDeclaration

      public IndexerDeclaration()
  • Method Details

    • getType

      public org.openrewrite.java.tree.JavaType getType()
      Specified by:
      getType in interface org.openrewrite.java.tree.TypedTree
    • withType

      public Cs.IndexerDeclaration withType(@Nullable org.openrewrite.java.tree.JavaType type)
      Specified by:
      withType in interface org.openrewrite.java.tree.TypedTree
    • getParameters

      public List<org.openrewrite.java.tree.Expression> getParameters()
    • withParameters

      public Cs.IndexerDeclaration withParameters(List<org.openrewrite.java.tree.Expression> parameters)
    • getExpressionBody

      public @Nullable org.openrewrite.java.tree.Expression getExpressionBody()
    • withExpressionBody

      public Cs.IndexerDeclaration withExpressionBody(@Nullable org.openrewrite.java.tree.Expression expressionBody)
    • acceptCSharp

      public <P> org.openrewrite.java.tree.J acceptCSharp(CSharpVisitor<P> v, P p)
      Specified by:
      acceptCSharp in interface Cs
    • getCoordinates

      public org.openrewrite.java.tree.CoordinateBuilder.Statement getCoordinates()
      Specified by:
      getCoordinates in interface org.openrewrite.java.tree.Statement
    • getPadding

      public Cs.IndexerDeclaration.Padding getPadding()