Package io.vertigo.datamodel.smarttype
Interface SmartTypeManager
- All Superinterfaces:
io.vertigo.core.node.component.Component,io.vertigo.core.node.component.CoreComponent,io.vertigo.core.node.component.Manager
- All Known Implementing Classes:
SmartTypeManagerImpl
public interface SmartTypeManager
extends io.vertigo.core.node.component.Manager
-
Method Summary
Modifier and TypeMethodDescriptionvoidcheckType(SmartTypeDefinition smartTypeDefinition, io.vertigo.core.lang.Cardinality cardinality, Object value) Checks the type of a given value.getTypeAdapters(String adapterType) Retrieves the type adapters for a given adapter type.stringToValue(SmartTypeDefinition smartTypeDefinition, String strValue) Converts a string to a value of the type defined by the SmartTypeDefinition.voidvalidate(SmartTypeDefinition smartTypeDefinition, io.vertigo.core.lang.Cardinality cardinality, Object value) Validates the value by checking all the constraints.valueToString(SmartTypeDefinition smartTypeDefinition, Object objValue) Converts the value to a string representation.
-
Method Details
-
checkType
void checkType(SmartTypeDefinition smartTypeDefinition, io.vertigo.core.lang.Cardinality cardinality, Object value) Checks the type of a given value. This method is used to verify if the provided value matches the expected type defined by the SmartTypeDefinition. The Cardinality parameter is used to determine if the value can be a collection (multiple values) or a single value.- Parameters:
smartTypeDefinition- The definition of the smart type, which includes the expected type of the value.cardinality- The cardinality of the value, which can be either single or multiple.value- The value to be checked.- Throws:
ClassCastException- If the value does not match the expected type.
-
validate
void validate(SmartTypeDefinition smartTypeDefinition, io.vertigo.core.lang.Cardinality cardinality, Object value) throws ConstraintException Validates the value by checking all the constraints. This method is used to verify if the provided value satisfies all the constraints defined by the SmartTypeDefinition. The Cardinality parameter is used to determine if the value can be a collection (multiple values) or a single value.- Parameters:
smartTypeDefinition- The definition of the smart type, which includes the constraints of the value.cardinality- The cardinality of the value, which can be either single or multiple.value- The value to be validated.- Throws:
ConstraintException- If the value does not satisfy the constraints.
-
valueToString
Converts the value to a string representation.- Parameters:
smartTypeDefinition- The definition of the smart type, which includes the expected type of the value.objValue- The value to be converted to a string.- Returns:
- The string representation of the value.
-
stringToValue
Object stringToValue(SmartTypeDefinition smartTypeDefinition, String strValue) throws FormatterException Converts a string to a value of the type defined by the SmartTypeDefinition.- Parameters:
smartTypeDefinition- The definition of the smart type, which includes the expected type of the value.strValue- The string to be converted to a value.- Returns:
- The value converted from the string.
- Throws:
FormatterException- If the string cannot be converted to the expected type.
-
getTypeAdapters
Retrieves the type adapters for a given adapter type.- Parameters:
adapterType- The type of the adapters to be retrieved.- Returns:
- A map of classes to their corresponding basic type adapters.
-