Package io.dialob.compiler
Class Utils
- java.lang.Object
-
- io.dialob.compiler.Utils
-
public class Utils extends Object
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static io.dialob.api.form.FormValidationErrorcreateError(String itemId, String message)static booleanisContextVariable(String type)static booleanisGroupType(ItemState itemState)static booleanisNote(String type)static booleanisProgramVariable(String type)static booleanisQuestionType(ItemState itemState)static booleanisRowgroup(String type)static booleanisVariable(String type)static Optional<ValueType>mapQuestionTypeToValueType(String type)static StringmapValueTypeToType(ValueType valueType)static Objectparse(ValueType valueType, Object value)static Objectparse(String type, Object answer)static DatereadNullableDate(com.google.protobuf.CodedInputStream input)static StringreadNullableString(com.google.protobuf.CodedInputStream input)static ObjectreadObjectValue(com.google.protobuf.CodedInputStream input)static io.dialob.api.proto.ActionItemtoActionItem(ItemState itemState, UnaryOperator<io.dialob.api.proto.ImmutableActionItem.Builder> post)static io.dialob.api.questionnaire.ErrortoError(ErrorState updated)static io.dialob.api.proto.ValueSettoValueSet(ValueSetState valueSetState)static ObjectvalidateDefaultValue(String id, ValueType valueType, Object value, Consumer<io.dialob.api.form.FormValidationError> errorListener)static voidwriteNullableDate(com.google.protobuf.CodedOutputStream output, Date date)static voidwriteNullableString(com.google.protobuf.CodedOutputStream output, String string)static voidwriteObjectValue(com.google.protobuf.CodedOutputStream output, Object value)
-
-
-
Method Detail
-
mapQuestionTypeToValueType
public static Optional<ValueType> mapQuestionTypeToValueType(String type)
-
isVariable
public static boolean isVariable(@Nonnull String type)
-
isContextVariable
public static boolean isContextVariable(@Nonnull String type)
-
isProgramVariable
public static boolean isProgramVariable(@Nonnull String type)
-
isNote
public static boolean isNote(@Nonnull String type)
-
isRowgroup
public static boolean isRowgroup(@Nonnull String type)
-
isGroupType
public static boolean isGroupType(@Nonnull ItemState itemState)
-
isQuestionType
public static boolean isQuestionType(@Nonnull ItemState itemState)
-
toValueSet
@Nonnull public static io.dialob.api.proto.ValueSet toValueSet(@Nonnull ValueSetState valueSetState)
-
toError
@Nonnull public static io.dialob.api.questionnaire.Error toError(@Nonnull ErrorState updated)
-
toActionItem
@Nonnull public static io.dialob.api.proto.ActionItem toActionItem(@Nonnull ItemState itemState, UnaryOperator<io.dialob.api.proto.ImmutableActionItem.Builder> post)
-
writeNullableString
public static void writeNullableString(@Nonnull com.google.protobuf.CodedOutputStream output, String string) throws IOException- Throws:
IOException
-
readNullableString
@Nullable public static String readNullableString(@Nonnull com.google.protobuf.CodedInputStream input) throws IOException
- Throws:
IOException
-
writeNullableDate
public static void writeNullableDate(@Nonnull com.google.protobuf.CodedOutputStream output, Date date) throws IOException- Throws:
IOException
-
readNullableDate
public static Date readNullableDate(@Nonnull com.google.protobuf.CodedInputStream input) throws IOException
- Throws:
IOException
-
writeObjectValue
public static void writeObjectValue(@Nonnull com.google.protobuf.CodedOutputStream output, Object value) throws IOException- Throws:
IOException
-
readObjectValue
public static Object readObjectValue(@Nonnull com.google.protobuf.CodedInputStream input) throws IOException
- Throws:
IOException
-
validateDefaultValue
public static Object validateDefaultValue(String id, ValueType valueType, Object value, Consumer<io.dialob.api.form.FormValidationError> errorListener)
-
-