use of org.whole.lang.parsers.IDataTypeParser in project whole by wholeplatform.
the class DataTypesGrammarsDataTypeParser method install.
public static void install(ILanguageKit lk, Map<EntityDescriptor<?>, IDataTypeParser> strategies) {
IDataTypeParser persistence = lk.getDataTypeParser(DataTypeParsers.PERSISTENCE);
IDataTypeParser persistenceStrategy = persistence.getStrategy();
IDataTypeParser presentation = lk.getDataTypeParser(DataTypeParsers.PRESENTATION);
IDataTypeParser presentationStrategy = presentation.getStrategy();
ForwardEntityDescriptorStrategyDataTypeParser persistenceForwardStrategy, presentationForwardStrategy;
if (persistenceStrategy.equals(presentationStrategy)) {
persistenceForwardStrategy = presentationForwardStrategy = new ForwardEntityDescriptorStrategyDataTypeParser(presentationStrategy);
persistenceForwardStrategy.putParserStrategies(strategies);
} else {
persistenceForwardStrategy = new ForwardEntityDescriptorStrategyDataTypeParser(presentationStrategy);
persistenceForwardStrategy.putParserStrategies(strategies);
presentationForwardStrategy = new ForwardEntityDescriptorStrategyDataTypeParser(presentationStrategy);
presentationForwardStrategy.putParserStrategies(strategies);
}
persistence.setStrategy(persistenceForwardStrategy);
presentation.setStrategy(presentationForwardStrategy);
}
use of org.whole.lang.parsers.IDataTypeParser in project whole by wholeplatform.
the class DataTypesGrammarsDataTypeParser method deploy.
public static void deploy(String grammarURI) {
Grammar grammar = GrammarsRegistry.instance().getGrammar(grammarURI);
ILanguageKit lk = ReflectionFactory.getLanguageKit(GrammarsUtils.getLanguageURI(grammar), false, null);
EntityDescriptor<?> ed = lk.getEntityDescriptorEnum().valueOf("DateLiteral");
Map<EntityDescriptor<?>, IDataTypeParser> strategies = new HashMap<EntityDescriptor<?>, IDataTypeParser>();
strategies.put(ed, new DataTypesGrammarsDataTypeParser());
install(lk, strategies);
}
Aggregations