From 8690e559733e161b88c6a2470b4229861a47ec15 Mon Sep 17 00:00:00 2001 From: Mircea MATEI Date: Thu, 14 Mar 2019 02:12:44 +0200 Subject: [PATCH] #9. Ignore annotation will exclude the field --- src/lib/generator/model_parser.dart | 3 +++ src/lib/generator/utils/entity_attribute.dart | 4 +++- src/test/src/model/healthy_entry.dart | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/generator/model_parser.dart b/src/lib/generator/model_parser.dart index 9658405..9e98c25 100644 --- a/src/lib/generator/model_parser.dart +++ b/src/lib/generator/model_parser.dart @@ -86,6 +86,9 @@ class ModelParser { if (rawEntityAttributes.length == 0) return; var firstField = rawEntityAttributes.first; + + if (mustIgnore(firstField.metadataLevel)) return; + if (firstField is EntityAttribute) { entityAttributes[firstField.modelName] = firstField; } diff --git a/src/lib/generator/utils/entity_attribute.dart b/src/lib/generator/utils/entity_attribute.dart index c493749..7740b83 100644 --- a/src/lib/generator/utils/entity_attribute.dart +++ b/src/lib/generator/utils/entity_attribute.dart @@ -4,6 +4,8 @@ class EntityAttribute { final String attributeName; + final int metadataLevel; + EntityAttribute(this.modelTypeName, this.modelName, this.attributeName, - {int metadataLevel}); + {this.metadataLevel}); } diff --git a/src/test/src/model/healthy_entry.dart b/src/test/src/model/healthy_entry.dart index 8d80730..81e037e 100644 --- a/src/test/src/model/healthy_entry.dart +++ b/src/test/src/model/healthy_entry.dart @@ -14,6 +14,12 @@ class HealthEntry implements DbEntity { @DataColumn("my_description_column", ColumnMetadata.Unique) String _description; + @DataColumn( + "my_future_column", + ColumnMetadata.Ignore | + ColumnMetadata.Unique) + int _futureData; + @override int get id => _id;