Class ObjectCreateBuilder

All Implemented Interfaces:
RuleProvider<ObjectCreateRule>

public final class ObjectCreateBuilder extends AbstractBackToLinkedRuleBuilder<ObjectCreateRule>
Builder chained when invoking LinkedRuleBuilder.createObject().
Since:
3.0
  • Field Details

    • classLoader

      private final ClassLoader classLoader
    • type

      private Class<?> type
    • attributeName

      private String attributeName
    • constructorArgumentsType

      private Class<?>[] constructorArgumentsType
      The constructor argument types
      Since:
      3.2
    • defaultConstructorArguments

      private Object[] defaultConstructorArguments
      Default constructor arguments.
      Since:
      3.2
  • Constructor Details

  • Method Details

    • ofType

      public ObjectCreateBuilder ofType(String className)
      Construct an object with the specified class name.
      Parameters:
      className - Java class name of the object to be created
      Returns:
      this builder instance
    • ofType

      public <T> ObjectCreateBuilder ofType(Class<T> type)
      Construct an object with the specified class.
      Type Parameters:
      T - any java type
      Parameters:
      type - Java class of the object to be created
      Returns:
      this builder instance
    • ofTypeSpecifiedByAttribute

      public ObjectCreateBuilder ofTypeSpecifiedByAttribute(String attributeName)
      Allows specify the attribute containing an override class name if it is present.
      Parameters:
      attributeName - The attribute containing an override class name if it is present
      Returns:
      this builder instance
    • usingConstructor

      public ObjectCreateBuilder usingConstructor(String... paramTypeNames)
      Allows users to specify constructor argument type names.
      Parameters:
      paramTypeNames - the constructor argument type names
      Returns:
      this builder instance
      Since:
      3.2
    • usingConstructor

      public ObjectCreateBuilder usingConstructor(Class<?>... constructorArgumentTypes)
      Allows users to specify constructor argument types.
      Parameters:
      constructorArgumentTypes - the constructor argument types
      Returns:
      this builder instance
      Since:
      3.2
    • usingDefaultConstructorArguments

      public ObjectCreateBuilder usingDefaultConstructorArguments(Object... defaultConstructorArguments)
      Allows users to specify default constructor arguments.
      Parameters:
      defaultConstructorArguments - the default constructor arguments.
      Returns:
      this builder instance
      Since:
      3.2
    • createRule

      protected ObjectCreateRule createRule()
      Provides an instance of Rule. Must never return null.
      Specified by:
      createRule in class AbstractBackToLinkedRuleBuilder<ObjectCreateRule>
      Returns:
      an instance of Rule.
      See Also: