use of org.whole.lang.parsers.IDataTypeParser in project whole by wholeplatform.
the class GenericBuilderContext method wEntity.
public void wEntity(EntityDescriptor<?> entityDesc, String value) {
DataKinds dataKind = entityDesc.getDataKind();
// FIXME workaround move responsibility into generated spec builder adapters
if (dataKind.isString())
builderStrategy.wEntity(entityDesc, value);
else {
IDataTypeParser dataTypeParser = DataTypeUtils.getDataTypeParser(entityDesc, DataTypeParsers.PERSISTENCE);
switch(dataKind) {
case DATE:
builderStrategy.wEntity(entityDesc, dataTypeParser.parseDate(entityDesc, value));
break;
case ENUM_VALUE:
builderStrategy.wEntity(entityDesc, dataTypeParser.parseEnumValue(entityDesc, value));
break;
case OBJECT:
builderStrategy.wEntity(entityDesc, dataTypeParser.parseObject(entityDesc, value));
break;
}
}
wNext();
}
use of org.whole.lang.parsers.IDataTypeParser in project whole by wholeplatform.
the class DataTypeUtils method buildFromPersistenceString.
public static void buildFromPersistenceString(IBuilder builder, EntityDescriptor<?> ed, String value) {
IDataTypeParser parser = getDataTypeParser(ed, DataTypeParsers.PERSISTENCE);
buildFromString(builder, ed, value, parser);
}
use of org.whole.lang.parsers.IDataTypeParser in project whole by wholeplatform.
the class DataTypeUtils method setFromPresentationString.
public static void setFromPresentationString(IEntity entity, String value) {
IDataTypeParser parser = getDataTypeParser(entity, DataTypeParsers.PRESENTATION);
setFromString(entity, value, parser);
}
use of org.whole.lang.parsers.IDataTypeParser in project whole by wholeplatform.
the class DataTypeUtils method setFromPersistenceString.
public static void setFromPersistenceString(IEntity entity, String value) {
IDataTypeParser parser = getDataTypeParser(entity, DataTypeParsers.PERSISTENCE);
setFromString(entity, value, parser);
}
use of org.whole.lang.parsers.IDataTypeParser in project whole by wholeplatform.
the class SchemaHelpers method deploySchemaOperations.
public static void deploySchemaOperations(final String languageUri) {
ILanguageKit lk = ReflectionFactory.getLanguageKit(languageUri, false, null);
if (!lk.isDynamic())
return;
// configure data-type parsers
IMappingStrategy mappingStrategy = MappingStrategyRegistry.instance().getMappingStrategy(languageUri);
IDataTypeParser parser = new XsiDataTypeParser(mappingStrategy.getDataTypeParsers());
DynamicLanguageKit languageKit = (DynamicLanguageKit) lk;
languageKit.setDataTypeParser(DataTypeParsers.PERSISTENCE, parser);
languageKit.setDataTypeParser(DataTypeParsers.PRESENTATION, parser);
// deploy a generic pretty print
ReflectionFactory.deploy(new AbstractLanguageExtensionDeployer() {
public void deploy(ReflectionFactory platform) {
platform.addOperationFactory(languageUri, PrettyPrinterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new XsiPrettyPrinterVisitor();
}
});
}
});
}
Aggregations