io.deephaven.appmode.StandardField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-application-mode Show documentation
Show all versions of deephaven-application-mode Show documentation
The 'application-mode' project
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.appmode;
import io.deephaven.annotations.BuildableStyle;
import org.immutables.value.Value.Check;
import org.immutables.value.Value.Immutable;
import java.util.Optional;
@Immutable
@BuildableStyle
public abstract class StandardField implements Field {
public static Field of(String name, T value) {
return ImmutableStandardField.builder().name(name).value(value).build();
}
public static Field of(String name, T value, String description) {
return ImmutableStandardField.builder().name(name).value(value).description(description)
.build();
}
public abstract String name();
public abstract T value();
public abstract Optional description();
@Check
final void checkName() {
if (!ApplicationUtil.isAsciiPrintable(name())) {
throw new IllegalArgumentException("name() is invalid, must be printable ascii");
}
}
@Check
final void checkDescription() {
if (description().isPresent() && description().get().isEmpty()) {
throw new IllegalArgumentException("description(), when present, must not be empty");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy