java.lang.Object
org.spongepowered.eventimplgen.eventgencore.AccessorFirstStrategy
All Implemented Interfaces:
PropertySearchStrategy

public class AccessorFirstStrategy extends Object implements PropertySearchStrategy
Finds properties by enumerating accessors and then later finding the closest matching mutator.
  • Constructor Details

    • AccessorFirstStrategy

      @AssistedInject public AccessorFirstStrategy(Types types, Elements elements, Descriptors descriptors, @Assisted boolean allowFluentStyle)
  • Method Details

    • getPropertyName

      public static String getPropertyName(CharSequence name)
      Clean up the property name.
      Parameters:
      name - The name
      Returns:
      The cleaned up name
    • findMutator

      @Nullable protected @Nullable ExecutableElement findMutator(ExecutableElement accessor, @Nullable @Nullable Collection<ExecutableElement> candidates, DeclaredType implementedBy)
      Find the corresponding mutator for an accessor method from a collection of candidates.
      Parameters:
      accessor - The accessor
      candidates - The collection of candidates
      implementedBy - The abstract super type implementation to consider
      Returns:
      A mutator, if found
    • findProperties

      public List<Property> findProperties(TypeElement type)
      Description copied from interface: PropertySearchStrategy
      Enumerate a list of properties on a class, considering super types and implemented interfaces.

      The returned list is sorted lexographically by property name

      Specified by:
      findProperties in interface PropertySearchStrategy
      Parameters:
      type - The class
      Returns:
      A set of properties