コード例 #1
0
  private <T> StructSchema<T> getSchema(
      Class<T> source, DefaultMethodModelRuleExtractionContext context) {
    if (!RuleSource.class.isAssignableFrom(source)
        || !source.getSuperclass().equals(RuleSource.class)) {
      context.add("Rule source classes must directly extend " + RuleSource.class.getName());
    }

    ModelSchema<T> schema = schemaStore.getSchema(source);
    if (!(schema instanceof StructSchema)) {
      return null;
    }

    validateClass(source, context);
    return (StructSchema<T>) schema;
  }