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

com.almworks.jira.structure.api.row.DummyRow Maven / Gradle / Ivy

There is a newer version: 17.25.3
Show newest version
package com.almworks.jira.structure.api.row;

import com.almworks.jira.structure.api.item.ItemIdentity;
import com.atlassian.annotations.Internal;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Internal
public class DummyRow implements StructureRow {
  private final long myRowId;

  @NotNull
  private final ItemIdentity myItemId;

  private final long mySemantics;

  @Nullable
  private final Object myItem;

  public DummyRow(long rowId, @NotNull ItemIdentity itemId, long semantics, @Nullable Object item) {
    StructureRows.validateForestRowId(rowId);
    myRowId = rowId;
    myItemId = itemId;
    mySemantics = semantics;
    myItem = item;
  }

  @Override
  public long getRowId() {
    return myRowId;
  }

  @NotNull
  @Override
  public ItemIdentity getItemId() {
    return myItemId;
  }

  @Override
  public long getSemantics() {
    return mySemantics;
  }

  @Nullable
  @Override
  public  I getItem(@NotNull Class itemClass) {
    return itemClass.isInstance(myItem) ? itemClass.cast(myItem) : null;
  }
}