Class FeatureInputType

Object
FeatureInputType

public class FeatureInputType extends Object
Performs checks and aggregations on feature-input types are compatible with others
Author:
Owen Feehan
  • Method Details

    • isCompatibleWith

      public static boolean isCompatibleWith(Class<? extends FeatureInput> sourceType, Class<? extends FeatureInput> otherType)
      Can these parameters be used with a particular feature?
      Parameters:
      sourceType - type of input.
      otherType - type of other.
      Returns:
      true iff the sourceType can be used with an input of otherType.
    • prefer

      public static Optional<Class<? extends FeatureInput>> prefer(Class<? extends FeatureInput> inputType1, Class<? extends FeatureInput> inputType2)
      Prefer to keep descriptor whose input-class is a sub-class rather than a super-class.

      The order of the two inputType parameters is irrelevant.

      Parameters:
      inputType1 - first input-type.
      inputType2 - second input-type.
      Returns:
      the favored input-type of the two, or Optional.empty() if there is no compatibility.
    • prefer

      public static Class<? extends FeatureInput> prefer(Feature<?> feature1, Feature<?> feature2)
      Like prefer(Class, Class) but accepts features directly as input.

      The order of the two inputType parameters is irrelevant.

      Parameters:
      feature1 - first-feature.
      feature2 - second-feature.
      Returns:
      the favored input-type of the two, or Optional.empty() if there is no compatibility.
    • determineInputType

      public static Class<? extends FeatureInput> determineInputType(Class<? extends FeatureInput> inputType1, Class<? extends FeatureInput> inputType2)
      Finds a common input-type for two classes, throwing an exception if the two types aren't compatible.
      Parameters:
      inputType1 - first input-type.
      inputType2 - second input-type.
      Returns:
      the favored input-type of the two.
      Throws:
      AnchorFriendlyRuntimeException - if they aren't compatible types.
    • determineInputType

      public static <T extends FeatureInput> Class<? extends FeatureInput> determineInputType(List<Feature<T>> list)
      Finds a common input-type for classes in the list, throwing an exception if any two types aren't compatible.
      Type Parameters:
      T - common parent input-type on the list (all elements in the list must have a input-type that sub-classes this).
      Parameters:
      list - list of features to determine a common input-type for.
      Returns:
      the commin input-type.
      Throws:
      AnchorFriendlyRuntimeException - if they are any two incompatible types.