Class SectionDefinitionBuilder<R,T extends SectionDefinitionBuilder<R,T>>

Type Parameters:
R - the returning type at endSection().
T - the type of the builder.
Direct Known Subclasses:
DtSectionDefinitionBuilder

public class SectionDefinitionBuilder<R,T extends SectionDefinitionBuilder<R,T>> extends AbstractContainerDefinitionBuilder<SectionDefinition,T>
Definition builder to build the section definition.
  • Constructor Details

    • SectionDefinitionBuilder

      protected SectionDefinitionBuilder(Supplier<SectionDefinition> provider, Consumer<SectionDefinition> endAction, R endSectionResult)
      Instantiates a new builder.
      Parameters:
      provider - the provider of section definition, cannot be null.
      endAction - the action performed when the builder ends section building.
      endSectionResult - the object that is returned by endSection().
  • Method Details

    • builder

      public static <R> SectionDefinitionBuilder<R,?> builder(Supplier<SectionDefinition> provider, Consumer<SectionDefinition> endAction, R endSectionResult)
      Creates a new builder.
      Parameters:
      provider - the provider of section definition, cannot be null.
      endAction - the action performed the builder ends section building.
      endSectionResult - the object that is returned by endSection().
      Returns:
      a newly created builder instance, never null.
    • element

      public T element(String label, org.eclipse.emf.ecore.EStructuralFeature... features)
      Creates a new FieldDefinition and adds it to the section.
      Parameters:
      label - the label of the field or null to disable label creation
      features - the features that represents the feature path, may be empty
      Returns:
      the builder instance, never null.
    • multiFeatureElement

      public T multiFeatureElement(String label, org.eclipse.emf.ecore.EStructuralFeature... features)
      Creates a new FieldDefinition with specified single-feature paths and adds it to the section.
      Parameters:
      label - the label of the field or null to disable label creation
      features - the features each of which defines its own single-feature path
      Returns:
      the builder instance, never null.
    • element

      public T element(String label, org.eclipse.emf.ecore.EOperation operation)
      Creates a new OperationFieldDefinition and adds to the section.
      Parameters:
      label - the label of the field or null to disable label creation
      operation - the operation, cannot be null.
      Returns:
      the builder instance, never null.
    • element

      public T element(String label, IDefinitionIdentifier definitionIdentifier)
      Creates a new ILabeledDefinition and adds to the section.
      Parameters:
      label - the label of the field or null to disable label creation
      definitionIdentifier - the definition identifier, cannot be null.
      Returns:
      the builder instance, never null.
    • element

      public T element(String label, String stringIdentifier)
      Creates a new ILabeledDefinition and adds to the section.
      Parameters:
      label - the label of the field or null to disable label creation
      stringIdentifier - the string that identifies definition uniquely, cannot be null.
      Returns:
      the builder instance, never null.
    • setup

      Returns the instance of the setup builder that allows to setup the currently positioned definition. If there are no definition added it returns the setup builder for the section definition.
      Returns:
      setup definition builder instance, never null.
    • componentFactory

      public T componentFactory(IComponentFactory componentFactory)
      Parameters:
      componentFactory - the component factory for the current element
      Returns:
      the builder instance, never null.
    • component

      public T component(Class<? extends IComponent> componentClass, IParameterization parameterization)
      Parameters:
      componentClass - Component class for the current element
      parameterization - Component parameterization for the current element
      Returns:
      The builder instance, never null.
    • separator

      public T separator()
      Creates SeparatorDefinition and adds it to section definition.
      Returns:
      the builder instance, never null.
    • endSection

      public R endSection()
      Ends section and performs the action that is given while instantiating the builder.
      Returns:
      the object given in constructor, never null.
    • fieldDefinition

      protected IDefinition fieldDefinition(Class<? extends IComponent<?>> componentClass, IParameterization parameterization, String label, org.eclipse.emf.databinding.FeaturePath... featurePaths)
      Cretets field definition for the provided parameters.
      Parameters:
      componentClass - the component class, cannot be null
      parameterization - the component parameterization, cannot be null
      label - the component label or null if none
      featurePaths - the EMF feature pathes, cannot be null
      Returns:
      the created definition, never null
    • operationFieldDefinition

      protected IDefinition operationFieldDefinition(Class<? extends IComponent<?>> componentClass, IParameterization parameterization, String label, org.eclipse.emf.ecore.EOperation operation)
      Cretets operation field definition for the provided parameters.
      Parameters:
      componentClass - the component class, cannot be null
      parameterization - the component parameterization, cannot be null
      label - the component label or null if none
      operation - the EMF operation, cannot be null
      Returns:
      the created definition, never null
    • stringIdDefiniton

      protected IDefinition stringIdDefiniton(Class<? extends IComponent<?>> componentClass, IParameterization parameterization, String label, String stringId)
      Cretets string identified field definition for the provided parameters.
      Parameters:
      componentClass - the component class, cannot be null
      parameterization - the component parameterization, cannot be null
      label - the component label or null if none
      stringId - the string identifier of the definition, cannot be null
      Returns:
      the created definition, never null
    • labeledDefinition

      protected IDefinition labeledDefinition(Class<? extends IComponent<?>> componentClass, IParameterization parameterization, String label, IDefinitionIdentifier definitionIdentifier)
      Cretets labeled definition for the provided parameters.
      Parameters:
      componentClass - the component class, cannot be null
      parameterization - the component parameterization, cannot be null
      label - the component label or null if none
      definitionIdentifier - the IDefinitionIdentifier instance, cannot be null.
      Returns:
      the created definition, never null.
    • getComponentParameterizationInfo

      protected SectionDefinitionBuilder.ComponentParameterizationInfo getComponentParameterizationInfo(org.eclipse.emf.ecore.EOperation operation)
      Returns the SectionDefinitionBuilder.ComponentParameterizationInfo for the given operation.
      Parameters:
      operation - the operation.
      Returns:
      the SectionDefinitionBuilder.ComponentParameterizationInfo.
    • getComponentParameterizationInfo

      protected SectionDefinitionBuilder.ComponentParameterizationInfo getComponentParameterizationInfo(org.eclipse.emf.ecore.EStructuralFeature... features)
      Returns the SectionDefinitionBuilder.ComponentParameterizationInfo for the given feature path.
      Parameters:
      features - the features that represents the feature path.
      Returns:
      the c the SectionDefinitionBuilder.ComponentParameterizationInfo.
    • getLastFeature

      protected static final org.eclipse.emf.ecore.EStructuralFeature getLastFeature(org.eclipse.emf.ecore.EStructuralFeature... features)
      Returns the last feature of the given feature array.
      Parameters:
      features - the features, may be null
      Returns:
      an EStructuralFeature instance or null
    • info

      protected static SectionDefinitionBuilder.ComponentParameterizationInfo info(Class<? extends IComponent<?>> componentClass, IParameterization parameterization)
      Builds SectionDefinitionBuilder.ComponentParameterizationInfo with the given parameters and returns it.
      Parameters:
      componentClass - the component class.
      parameterization - the parameterization.
      Returns:
      SectionDefinitionBuilder.ComponentParameterizationInfo.
    • setElementLogger

      protected void setElementLogger(Consumer<IDefinition> logger)
      Sets a logger that will be called from each element(String, EStructuralFeature...) call.