@Test(expected = IllegalMetaClassException.class) public void testSetInternalClassFields() { MetaClass mClass = new MetaClass(); List<MetaField> fields = new ArrayList<MetaField>(); MetaField idField = InternalFieldFactory.getInternalMetaField(InternalFieldEnum.ID); fields.add(idField); mClass.setClassFields(fields); }
@JsonProperty("fields") @JsonDeserialize(using = MetaClassConverters.MetaFieldDeserializer.class) void setClassFields(Collection<MetaField> fields) { fieldNameIndex.clear(); dbNameIndex.clear(); flattenValueDbNameIndex.clear(); for (MetaField f : fields) { if (f.isInternal()) { throw new IllegalMetaClassException("MetaField name can not use reserved name"); } addField(f); } init(); }
MetaClass { @JsonProperty("fields") @JsonDeserialize(using = MetaClassConverters.MetaFieldDeserializer.class) void setClassFields(Collection<MetaField> fields) { fieldNameIndex.clear(); dbNameIndex.clear(); flattenValueDbNameIndex.clear(); for (MetaField f : fields) { if (f.isInternal()) { throw new IllegalMetaClassException("MetaField name can not use reserved name"); } addField(f); } init(); } }
MetaClass { @JsonProperty("fields") @JsonDeserialize(using = MetaClassConverters.MetaFieldDeserializer.class) void setClassFields(Collection<MetaField> fields) { fieldNameIndex.clear(); dbNameIndex.clear(); flattenValueDbNameIndex.clear(); for (MetaField f : fields) { if (f.isInternal()) { throw new IllegalMetaClassException("MetaField name can not use reserved name"); } addField(f); } init(); } MetaClass();  MetaClass(MetaClass other); }
MetaClass { @JsonProperty("fields") @JsonDeserialize(using = MetaClassConverters.MetaFieldDeserializer.class) void setClassFields(Collection<MetaField> fields) { fieldNameIndex.clear(); dbNameIndex.clear(); flattenValueDbNameIndex.clear(); for (MetaField f : fields) { if (f.isInternal()) { throw new IllegalMetaClassException("MetaField name can not use reserved name"); } addField(f); } init(); } MetaClass();  MetaClass(MetaClass other); @JsonProperty("_id") String getId(); @JsonProperty("_id") @JsonDeserialize(using = MongoObjectIdConverter.ObjectIdDeserializer.class) void setId(String id); @JsonProperty("allowFullTableScan") Boolean getAllowFullTableScan(); @JsonIgnore Boolean isAllowFullTableScan(); void setAllowFullTableScan(Boolean allowFullTableScan); String getpluralName(); void setpluralName(String pluralName); String getDescription(); void setDescription(String description); String getParent(); void setParent(String parent); List<String> getAncestors(); void setAncestors(List<String> ancestors); boolean isAssignableFrom(MetaClass c); @JsonIgnore void setMetadataService(IMetadataService metadataService); @JsonIgnore IMetadataService getMetadataService(); @JsonIgnore MetaClass getParentMetaClass(); String getName(); void setName(String name); Date getLastModified(); void setLastModified(Date lastModified); int getVersion(); void setVersion(int version); int getParentVersion(); void setParentVersion(int parentVersion); @JsonProperty("fields") @JsonSerialize(using = MetaClassConverters.MetaFieldSerializer.class) Collection<MetaField> getClassFields(); void addField(MetaField metaField); MetaField getFieldByName(String fieldName); MetaField getFieldByDbName(String dbName); MetaField getFieldByFlattenValueDbName(String valueDbName); @JsonIgnore Collection<MetaField> getFields(); @JsonIgnore List<MetaAttribute> getExpressionFields(); @JsonIgnore List<MetaAttribute> getValidationFields(); @JsonIgnore Collection<String> getFieldNames(); String getRepository(); void setRepository(String repository); void setupAncestors(IMetadataService metadataService, Map<String, MetaClass> metas); @JsonIgnore List<MetaRelationship> getFromReference(); @JsonIgnore List<MetaRelationship> getToReference(); @JsonIgnore List<MetaClass> getDescendants(); @Override String toString(); void setMetaclassGraph(MetaClassGraph graph); @JsonIgnore void addIndex(IndexInfo index); @JsonIgnore IndexInfo getIndexByName(String indexName); @JsonIgnore Collection<IndexInfo> getIndexes(); @JsonIgnore Map<String, IndexInfo> getIndexesMap(); @JsonIgnore Collection<IndexInfo> getIndexesOnField(String fieldName); @JsonIgnore Collection<IndexInfo> getClassIndexes(); @JsonIgnore Collection<String> getIndexNames(); @JsonProperty("options") MetaOption getOptions(); void traverse(IMetadataVisistor visitor); @Override int hashCode(); @Override boolean equals(Object o); @JsonProperty("embed") Boolean getEmbed(); @JsonIgnore Boolean isEmbed(); void setEmbed(Boolean embed); @JsonProperty("inner") Boolean getInner(); @JsonIgnore boolean isInner(); void setInner(Boolean inner); @JsonIgnore boolean isMetaSharded(); void setSharded(boolean sharded); void addReferenceIndexes(); boolean hasExpressionFields(); @JsonIgnore List<MetaField> getEmbedWithExprs(); boolean hasValidationFields(); @JsonIgnore List<MetaField> getEmbedWithValidations(); }
MetaClass { @JsonProperty("fields") @JsonDeserialize(using = MetaClassConverters.MetaFieldDeserializer.class) void setClassFields(Collection<MetaField> fields) { fieldNameIndex.clear(); dbNameIndex.clear(); flattenValueDbNameIndex.clear(); for (MetaField f : fields) { if (f.isInternal()) { throw new IllegalMetaClassException("MetaField name can not use reserved name"); } addField(f); } init(); } MetaClass();  MetaClass(MetaClass other); @JsonProperty("_id") String getId(); @JsonProperty("_id") @JsonDeserialize(using = MongoObjectIdConverter.ObjectIdDeserializer.class) void setId(String id); @JsonProperty("allowFullTableScan") Boolean getAllowFullTableScan(); @JsonIgnore Boolean isAllowFullTableScan(); void setAllowFullTableScan(Boolean allowFullTableScan); String getpluralName(); void setpluralName(String pluralName); String getDescription(); void setDescription(String description); String getParent(); void setParent(String parent); List<String> getAncestors(); void setAncestors(List<String> ancestors); boolean isAssignableFrom(MetaClass c); @JsonIgnore void setMetadataService(IMetadataService metadataService); @JsonIgnore IMetadataService getMetadataService(); @JsonIgnore MetaClass getParentMetaClass(); String getName(); void setName(String name); Date getLastModified(); void setLastModified(Date lastModified); int getVersion(); void setVersion(int version); int getParentVersion(); void setParentVersion(int parentVersion); @JsonProperty("fields") @JsonSerialize(using = MetaClassConverters.MetaFieldSerializer.class) Collection<MetaField> getClassFields(); void addField(MetaField metaField); MetaField getFieldByName(String fieldName); MetaField getFieldByDbName(String dbName); MetaField getFieldByFlattenValueDbName(String valueDbName); @JsonIgnore Collection<MetaField> getFields(); @JsonIgnore List<MetaAttribute> getExpressionFields(); @JsonIgnore List<MetaAttribute> getValidationFields(); @JsonIgnore Collection<String> getFieldNames(); String getRepository(); void setRepository(String repository); void setupAncestors(IMetadataService metadataService, Map<String, MetaClass> metas); @JsonIgnore List<MetaRelationship> getFromReference(); @JsonIgnore List<MetaRelationship> getToReference(); @JsonIgnore List<MetaClass> getDescendants(); @Override String toString(); void setMetaclassGraph(MetaClassGraph graph); @JsonIgnore void addIndex(IndexInfo index); @JsonIgnore IndexInfo getIndexByName(String indexName); @JsonIgnore Collection<IndexInfo> getIndexes(); @JsonIgnore Map<String, IndexInfo> getIndexesMap(); @JsonIgnore Collection<IndexInfo> getIndexesOnField(String fieldName); @JsonIgnore Collection<IndexInfo> getClassIndexes(); @JsonIgnore Collection<String> getIndexNames(); @JsonProperty("options") MetaOption getOptions(); void traverse(IMetadataVisistor visitor); @Override int hashCode(); @Override boolean equals(Object o); @JsonProperty("embed") Boolean getEmbed(); @JsonIgnore Boolean isEmbed(); void setEmbed(Boolean embed); @JsonProperty("inner") Boolean getInner(); @JsonIgnore boolean isInner(); void setInner(Boolean inner); @JsonIgnore boolean isMetaSharded(); void setSharded(boolean sharded); void addReferenceIndexes(); boolean hasExpressionFields(); @JsonIgnore List<MetaField> getEmbedWithExprs(); boolean hasValidationFields(); @JsonIgnore List<MetaField> getEmbedWithValidations(); static final String NAME; static final String PLURAL_NAME; static final String ANCESTERS_NAME; static final String REPOSITORY_NAME; static final String VERSION; static final List<String> RESERVED_METACLASS_NAME; }