private Name generateSupport(EmitContext context, ModelDeclaration model) throws IOException { assert context != null; assert model != null; EmitContext next = new EmitContext( context.getSemantics(), context.getConfiguration(), model, CATEGORY_STREAM, "{0}CsvSupport"); LOG.debug("Generating CSV support for {}", context.getQualifiedTypeName().toNameString()); SupportGenerator.emit(next, model, model.getTrait(CsvSupportTrait.class).getConfiguration()); LOG.debug( "Generated CSV support for {}: {}", context.getQualifiedTypeName().toNameString(), next.getQualifiedTypeName().toNameString()); return next.getQualifiedTypeName(); }
private Type generate(EmitContext context, ModelDeclaration model) throws IOException { EmitContext next = new EmitContext( context.getSemantics(), context.getConfiguration(), model, NameConstants.CATEGORY_IO, "{0}Input"); Generator.emit(next, model); return context.resolve(next.getQualifiedTypeName()); }
private Name generateExporter(EmitContext context, ModelDeclaration model, Name supportName) throws IOException { assert context != null; assert model != null; assert supportName != null; EmitContext next = new EmitContext( context.getSemantics(), context.getConfiguration(), model, CATEGORY_STREAM, "Abstract{0}CsvExporterDescription"); LOG.debug( "Generating CSV exporter description for {}", context.getQualifiedTypeName().toNameString()); DescriptionGenerator.emitExporter(next, model, supportName); LOG.debug( "Generated CSV exporter description for {}: {}", context.getQualifiedTypeName().toNameString(), next.getQualifiedTypeName().toNameString()); return next.getQualifiedTypeName(); }
private long computeModelVersion( EmitContext context, ModelDeclaration model, CacheSupportTrait trait) { assert context != null; assert model != null; assert trait != null; long hash = 1; final long prime = 31; hash = hash * prime + context.getQualifiedTypeName().toNameString().hashCode(); hash = hash * prime + trait.getSid().getName().identifier.hashCode(); hash = hash * prime + trait.getTimestamp().getName().identifier.hashCode(); for (PropertyDeclaration property : model.getDeclaredProperties()) { hash = hash * prime + property.getName().identifier.hashCode(); com.asakusafw.dmdl.semantics.Type type = property.getType(); assert type instanceof BasicType; hash = hash * prime + ((BasicType) type).getKind().name().hashCode(); } return hash; }