sdmxdl.Component Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdmx-dl-api Show documentation
Show all versions of sdmx-dl-api Show documentation
Easily download official statistics - API
The newest version!
package sdmxdl;
import lombok.NonNull;
import nbbrd.design.SealedType;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Collections;
import java.util.Map;
/**
* Abstract component of a DataStructure.
*/
@SealedType({
Dimension.class,
Attribute.class
})
public abstract class Component implements HasName {
public abstract @NonNull String getId();
public abstract @Nullable Codelist getCodelist();
/**
* Check if this component has a codelist.
*
* @return true if codelist, false otherwise
*/
public final boolean isCoded() {
return getCodelist() != null;
}
public final @NonNull Map getCodes() {
Codelist codelist = getCodelist();
return codelist != null ? codelist.getCodes() : Collections.emptyMap();
}
public static abstract class Builder> {
@NonNull
public abstract B id(@NonNull String id);
public abstract @NonNull B codelist(@NonNull Codelist codelist);
@NonNull
public abstract B name(@NonNull String name);
}
}