@Test public void convertToTypeConvertsExplicitTypeWithoutFieldsToType() { ExplicitType explicitType = new ExplicitType("TestType", null); Type type = explicitType.convertToType(); assertThat(type.getName(), is("TestType")); }
public Type convertToType() { if (this.collectionId.endsWith("List")) { throw new RuntimeException("Collection_id cannot end with 'List'"); } Type convertedType = new Type(collectionId); Collection<Predicate> predicates = new HashSet<>(); if (fields == null || fields.isEmpty()) { return convertedType; } for (ExplicitField field : fields) { Predicate convertedPredicate = field.convertToPredicate(); convertedPredicate.setIsExplicit(true); predicates.add(convertedPredicate); } convertedType.setPredicates(predicates); return convertedType; }
ExplicitType { public Type convertToType() { if (this.collectionId.endsWith("List")) { throw new RuntimeException("Collection_id cannot end with 'List'"); } Type convertedType = new Type(collectionId); Collection<Predicate> predicates = new HashSet<>(); if (fields == null || fields.isEmpty()) { return convertedType; } for (ExplicitField field : fields) { Predicate convertedPredicate = field.convertToPredicate(); convertedPredicate.setIsExplicit(true); predicates.add(convertedPredicate); } convertedType.setPredicates(predicates); return convertedType; } }
ExplicitType { public Type convertToType() { if (this.collectionId.endsWith("List")) { throw new RuntimeException("Collection_id cannot end with 'List'"); } Type convertedType = new Type(collectionId); Collection<Predicate> predicates = new HashSet<>(); if (fields == null || fields.isEmpty()) { return convertedType; } for (ExplicitField field : fields) { Predicate convertedPredicate = field.convertToPredicate(); convertedPredicate.setIsExplicit(true); predicates.add(convertedPredicate); } convertedType.setPredicates(predicates); return convertedType; } @JsonCreator  ExplicitType(@JsonProperty("collectionId") String collectionId,
                      @JsonProperty("fields") List<ExplicitField> fields); }
ExplicitType { public Type convertToType() { if (this.collectionId.endsWith("List")) { throw new RuntimeException("Collection_id cannot end with 'List'"); } Type convertedType = new Type(collectionId); Collection<Predicate> predicates = new HashSet<>(); if (fields == null || fields.isEmpty()) { return convertedType; } for (ExplicitField field : fields) { Predicate convertedPredicate = field.convertToPredicate(); convertedPredicate.setIsExplicit(true); predicates.add(convertedPredicate); } convertedType.setPredicates(predicates); return convertedType; } @JsonCreator  ExplicitType(@JsonProperty("collectionId") String collectionId,
                      @JsonProperty("fields") List<ExplicitField> fields); String getCollectionId(); List<ExplicitField> getFields(); Type convertToType(); }
ExplicitType { public Type convertToType() { if (this.collectionId.endsWith("List")) { throw new RuntimeException("Collection_id cannot end with 'List'"); } Type convertedType = new Type(collectionId); Collection<Predicate> predicates = new HashSet<>(); if (fields == null || fields.isEmpty()) { return convertedType; } for (ExplicitField field : fields) { Predicate convertedPredicate = field.convertToPredicate(); convertedPredicate.setIsExplicit(true); predicates.add(convertedPredicate); } convertedType.setPredicates(predicates); return convertedType; } @JsonCreator  ExplicitType(@JsonProperty("collectionId") String collectionId,
                      @JsonProperty("fields") List<ExplicitField> fields); String getCollectionId(); List<ExplicitField> getFields(); Type convertToType();  }