private FeatureInfo createFeature(Method method, FeatureMetadata featureMetadata) {
    FeatureInfo feature = new FeatureInfo();
    feature.setParent(spec);
    feature.setName(featureMetadata.name());
    feature.setLine(featureMetadata.line());
    feature.setDeclarationOrder(featureMetadata.ordinal());
    for (String name : featureMetadata.parameterNames())
      feature.addParameterName(name);

    MethodInfo featureMethod = new MethodInfo();
    featureMethod.setParent(spec);
    featureMethod.setName(featureMetadata.name());
    featureMethod.setLine(featureMetadata.line());
    featureMethod.setFeature(feature);
    featureMethod.setReflection(method);
    featureMethod.setKind(MethodKind.FEATURE);
    feature.setFeatureMethod(featureMethod);

    String processorMethodName = InternalIdentifiers.getDataProcessorName(method.getName());
    MethodInfo dataProcessorMethod = createMethod(processorMethodName, MethodKind.DATA_PROCESSOR);

    if (dataProcessorMethod != null) {
      feature.setDataProcessorMethod(dataProcessorMethod);

      DataProcessorMetadata dataProcessorMetadata = dataProcessorMethod.getAnnotation(DataProcessorMetadata.class);
      for (String dataVariable : dataProcessorMetadata.dataVariables()) {
        feature.addDataVariable(dataVariable);
      }

      int providerCount = 0;
      String providerMethodName = InternalIdentifiers.getDataProviderName(method.getName(), providerCount++);
      MethodInfo providerMethod = createMethod(providerMethodName, MethodKind.DATA_PROVIDER);
      while (providerMethod != null) {
        feature.addDataProvider(createDataProvider(feature, providerMethod));
        providerMethodName = InternalIdentifiers.getDataProviderName(method.getName(), providerCount++);
        providerMethod = createMethod(providerMethodName, MethodKind.DATA_PROVIDER);
      }

      if (providerCount > 1) {
        String variableMultiplicationsMethodName = InternalIdentifiers.getDataVariableMultiplicationsName(method.getName());
        MethodInfo dataVariableMultiplicationsMethod = createMethod(variableMultiplicationsMethodName, MethodKind.DATA_VARIABLE_MULTIPLICATIONS);

        if (dataVariableMultiplicationsMethod != null) {
          feature.setDataVariableMultiplicationsMethod(dataVariableMultiplicationsMethod);
        }

        String filterMethodName = InternalIdentifiers.getFilterName(method.getName());
        MethodInfo filterMethod = createMethod(filterMethodName, MethodKind.FILTER);

        if (filterMethod != null) {
          feature.setFilterMethod(filterMethod);
        }
      }
    }

    for (BlockMetadata blockMetadata : featureMetadata.blocks()) {
      feature.addBlock(new BlockInfo(blockMetadata.kind(), asList(blockMetadata.texts())));
    }

    return feature;
  }
Builds a SpecInfo from a Class instance.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/runtime/SpecInfoBuilder.java