Package nl._42.beanie

Interface EditableBeanBuildCommand<T>

All Superinterfaces:
BeanBuildCommand<T>

public interface EditableBeanBuildCommand<T> extends BeanBuildCommand<T>
Bean build command that allows users to declare custom property values.
Since:
Feb 14, 2014
Author:
Jeroen van Schagen
  • Method Details

    • withValue

      EditableBeanBuildCommand<T> withValue(String propertyName, Object value)
      Declare a value in our to be generated bean.
      Parameters:
      propertyName - the property name
      value - the property value
      Returns:
      this instance, for chaining
    • load

      EditableBeanBuildCommand<T> load(Object bean, String... exclusions)
      Copies all usable property values from a bean into our result.
      Parameters:
      bean - the bean to copy properties from
      exclusions - the property names to exclude from copy
      Returns:
      this instance, for chaining
    • map

      Perform a mapping on the intermediate object, changing it into the result object of our function.
      Parameters:
      function - the function that should be performed
      Returns:
      this instance, for chaining
    • map

      <M> EditableBeanBuildCommand<M> map(Class<M> targetType)
      Perform a mapping on the intermediate object, changing the type to targetType.
      Type Parameters:
      M - The target class
      Parameters:
      targetType - The type the intermediate object should continue to have
      Returns:
      new instance of EditableBeanBuildCommand
    • map

      <I extends EditableBeanBuildCommand<M>, M> I map(Class<I> interfaceType, Class<M> targetType)
      Combination of as and map, performs a mapping on the intermediate object, changing the type to the targetType and changing the EditableBeanBuild command interface.
      Type Parameters:
      I - The new EditableBeanBuildCommand interface
      M - The target class
      Parameters:
      interfaceType - The new interface type to continue with
      targetType - The type the intermediate object should continue to have
      Returns:
      new instance of EditableBeanBuildCommand
    • as

      <I extends EditableBeanBuildCommand<T>, T> I as(Class<I> interfaceType)
      Changes the interface type. This allows you to continue with another command.
      Type Parameters:
      I - the interface type
      T - the bean type
      Parameters:
      interfaceType - the new interface type class
      Returns:
      new command instance of specified type
    • doWith

      EditableBeanBuildCommand<T> doWith(Consumer<T> consumer)
      Perform an operation on the intermediate object.
      Parameters:
      consumer - the consumer that should take our object
      Returns:
      this instance, for chaining
    • generateValue

      EditableBeanBuildCommand<T> generateValue(String propertyName, ValueGenerator generator)
      Generate a value in our to be generated bean.
      Parameters:
      propertyName - the property name
      generator - the value generator
      Returns:
      this instance, for chaining
    • generateValue

      EditableBeanBuildCommand<T> generateValue(String... propertyNames)
      Generate a value in our to be generated bean.
      Parameters:
      propertyNames - the property names
      Returns:
      this instance, for chaining
    • setBeanSaver

      EditableBeanBuildCommand<T> setBeanSaver(Function<T,T> beanSaver)
      Register a callback before saving the generated bean.
      Parameters:
      beanSaver - the bean saver
      Returns:
      this instance, for chaining