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

org.dominokit.domino.ui.datatable.RowAppenderMeta Maven / Gradle / Ivy

/*
 * Copyright © 2019 Dominokit
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.dominokit.domino.ui.datatable;

import java.util.Objects;
import java.util.Optional;
import org.dominokit.domino.ui.utils.ComponentMeta;

/**
 * A meta information class for storing a row appender in a data table row.
 *
 * @param  The type of data in the data table.
 */
public class RowAppenderMeta implements ComponentMeta {

  public static final String TABLE_ROW_APPENDER_META = "table-row-appender-meta";

  private final TableConfig.RowAppender rowAppender;

  /**
   * Creates a new instance of {@code RowAppenderMeta} with the provided row appender.
   *
   * @param  The type of data in the data table.
   * @param rowAppender The row appender to store.
   * @return A new {@code RowAppenderMeta} instance with the provided row appender.
   */
  public static  RowAppenderMeta of(TableConfig.RowAppender rowAppender) {
    return new RowAppenderMeta<>(rowAppender);
  }

  /**
   * Creates a new instance of {@code RowAppenderMeta} with the provided row appender.
   *
   * @param rowAppender The row appender to store.
   */
  public RowAppenderMeta(TableConfig.RowAppender rowAppender) {
    Objects.requireNonNull(rowAppender, "RowAppender cant be null.");
    this.rowAppender = rowAppender;
  }

  /**
   * Retrieves a {@code RowAppenderMeta} instance associated with a specific data table row.
   *
   * @param  The type of data in the data table.
   * @param row The data table row.
   * @return An optional containing the {@code RowAppenderMeta} instance if found, or an empty
   *     optional if not found.
   */
  public static  Optional> get(TableRow row) {
    return row.getMeta(TABLE_ROW_APPENDER_META);
  }

  /**
   * Gets the stored row appender.
   *
   * @return The row appender.
   */
  public TableConfig.RowAppender getRowAppender() {
    return rowAppender;
  }

  /**
   * {@inheritDoc}
   *
   * 

Returns the key that identifies the type of metadata associated with this class. * * @return The key for identifying metadata of this type. */ @Override public String getKey() { return TABLE_ROW_APPENDER_META; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy