com.almworks.jira.structure.api.attribute.RowValues Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of structure-api Show documentation
Show all versions of structure-api Show documentation
Public API for the Structure Plugin for JIRA
package com.almworks.jira.structure.api.attribute;
import com.almworks.integers.LongSizedIterable;
import com.atlassian.annotations.PublicApi;
import org.jetbrains.annotations.Nullable;
import java.util.function.*;
/**
* An object that implements {@code RowValues} interface is supplied as a result of attributes calculation by
* {@link StructureAttributeService}. The interface allows retrieval of values by row ID and attribute specification.
*
* @see StructureAttributeService
* @see AttributeSpec
*/
@PublicApi
public interface RowValues extends LoadedValues {
RowValues EMPTY = new RowValues() {
@Nullable
@Override
public LoadedValue getLoadedValue(@Nullable Long key, @Nullable AttributeSpec attribute) {
return null;
}
@Override
public void consume(Function, BiConsumer>>> consumer) {}
};
/**
* Passes all data to the consumer. Consumer will be called only once for each attribute spec. It can return a null
* or a biconsumer that will then be fed all row ids that are in use and a function to retrieve a value for each row id.
*
* @param consumer
*/
void consume(Function, BiConsumer>>> consumer);
default T get(long key, @Nullable AttributeSpec attribute) {
// this method is needed because otherwise get(1, attribute) will fail - int won't be converted to T=Long because of erasure
return get((Long)key, attribute);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy