class Fabric8ObjectRule extends ObjectRule {
  private static final String INTERFACE_TYPE_PROPERTY = "interfaceType";
  private static final String INTERFACE_IMPLEMENTATIONS_TYPE_PROPERTY = "interfaceImpls";
  private static final String VALUE_PROPERTY = "value";

  private final RuleFactory ruleFactory;

  protected Fabric8ObjectRule(RuleFactory ruleFactory, ParcelableHelper parcelableHelper, ReflectionHelper reflectionHelper) {
    super(ruleFactory, parcelableHelper, reflectionHelper);

    this.ruleFactory = ruleFactory;
  }

  @Override
  public JType apply(String nodeName, JsonNode node, JsonNode parent, JPackage _package, Schema schema) {
    if (node.has(INTERFACE_TYPE_PROPERTY)) {
      // interface
      return createInterface(node, _package);
    }

    // rest of types
    return super.apply(nodeName, node, parent, _package, schema);
  }

  private JType createInterface(JsonNode node, JPackage _package) {<FILL_FUNCTION_BODY>}
}

    String fqn = node.path(INTERFACE_TYPE_PROPERTY).asText();
    int index = fqn.lastIndexOf(".") + 1;

    JDefinedClass newType;
    try {
      newType = _package._interface(fqn.substring(index));
    } catch (JClassAlreadyExistsException ex) {
      return ex.getExistingClass();
    }

    this.ruleFactory.getAnnotator().typeInfo(newType, node);
    this.ruleFactory.getAnnotator().propertyInclusion(newType, node);

    // Allow to deserialize the interface from implementations:
    if (node.has(INTERFACE_IMPLEMENTATIONS_TYPE_PROPERTY)) {
      newType.annotate(JsonTypeResolver.class).param(VALUE_PROPERTY, UnwrappedTypeResolverBuilder.class);
      JAnnotationArrayMember subTypes = newType.annotate(JsonSubTypes.class).paramArray(VALUE_PROPERTY);
      JsonNode implementationsNode = node.get(INTERFACE_IMPLEMENTATIONS_TYPE_PROPERTY);
      List<String> implementations = new ArrayList<>();
      for (JsonNode implementationNode : implementationsNode) {
        String implementation = implementationNode.textValue();
        implementations.add(implementation);
        subTypes.annotate(JsonSubTypes.Type.class).param(VALUE_PROPERTY, new JCodeModel().ref(implementation));
      }

      JAnnotationUse jsonTypeAnnotation = newType.annotate(JsonTypeInfo.class).param("use", JsonTypeInfo.Id.DEDUCTION);
      if (implementations.size() == 1) {
        jsonTypeAnnotation.param("defaultImpl", new JCodeModel().ref(implementations.get(0)));
      }
    }

    return newType;
  
<no_super_class>