Interface Component<C extends Component<C>>

    • Method Detail

      • getClassifier

        @Nullable
        String getClassifier()
        An indicator of the class of components this component belongs to. This is used to distinguish components that behave in similar ways within a context. For instance, Classifiers.FIELD is used to distinguish fields from other form components, and fields have unique interactions available to them, such as interacting with the form state.
        Returns:
        the classifier of the component
        See Also:
        for a list of classifiers
      • getType

        @Nullable
        String getType()
        An indicator of the type of this component. This is used to target a specific component within a class of components. For instance, a type of FieldTypes.STRING for a Classifiers.FIELD will result in a text input for managing a property.
        Returns:
        the type of the component
      • getId

        @Nullable
        String getId()
        A unique identifier for the component among its siblings. Not necessarily globally unique.
        Returns:
        the ID of the component
      • getAugmentationKey

        @Nullable
        String getAugmentationKey()
        A unique identifier for the component within its full component tree. Used for targeting augmentations.
        Returns:
        the augmentation key
      • isAugmentable

        default boolean isAugmentable()
        Whether or not the component is able to be augmented. True if the augmentation key is present.
        Returns:
        whether or not augmentable
      • getDescription

        @Nullable
        InternationalizedMessage getDescription()
        A description used for display purposes.
        Returns:
        the description
      • getOrder

        @Nullable
        Integer getOrder()
        The absolute ordering of this component among its siblings. If null, will be sorted last.
        Returns:
        the order
      • getScope

        @Nullable
        String getScope()
        The resource scope necessary for this component. This is used by many components in order to gate access based on the resource scopes a user has access to.
        Returns:
        the scope
      • isTranslatable

        boolean isTranslatable()
        Whether or not this component deals with translatable data. The meaning of this field varies between classes of components and types of components.
        Returns:
        whether or not translatable
      • getConditionals

        List<Conditional<?>> getConditionals()
        A set of conditions used to indicate when this component should be rendered. This is most commonly used by form components to hide/show fields and grids depending on the form state.
        Returns:
        the set of conditionals
      • getAttributes

        Map<String,​Object> getAttributes()
        A key-value map used to provide additional metadata beyond the first-class properties.
        Returns:
        the attributes map
      • getComponents

        Map<String,​Component<?>> getComponents()
        A key-value map of components used for managing the children components of this component.
        Returns:
        the map of children
      • getActions

        Map<String,​Action<?>> getActions()
        A key-value map of actions used for managing the actions of this component.
        Returns:
        the map of actions
      • getEndpoints

        Map<String,​Endpoint<?>> getEndpoints()
        A key-value map of endpoints used for managing the endpoints of this component. The type of the endpoint is used as the key in the map.
        Returns:
        the map of endpoints
      • getComponentsList

        default Collection<Component<?>> getComponentsList()
        The serializable, sorted list of children components.
        Returns:
        a serializable, sorted list of children components
      • getActionsList

        default Collection<Action<?>> getActionsList()
        The serializable, sorted list of actions.
        Returns:
        a serializable, sorted list of actions.
      • getEndpointsList

        default Collection<Endpoint<?>> getEndpointsList()
        The serializable list of endpoints.
        Returns:
        a serializable list of endpoints
      • setClassifier

        void setClassifier​(String classifier)
      • setType

        void setType​(String type)
      • setId

        void setId​(String id)
      • setAugmentationKey

        void setAugmentationKey​(String augmentationKey)
      • setOrder

        void setOrder​(Integer order)
      • setScope

        void setScope​(String scope)
      • setTranslatable

        void setTranslatable​(boolean translatable)
      • setConditionals

        void setConditionals​(List<Conditional<?>> conditionals)
      • self

        default C self()
        Used internally to grab this component casted to Component.
        Returns:
        this
      • apply

        default C apply​(Consumer<? super C> fn)
        Executes the provided function with this component as an argument.
        Parameters:
        fn - the function
        Returns:
        this
      • classifier

        default C classifier​(String classifier)
        Sets the classifier of this component.
        Parameters:
        classifier - the classifier
        Returns:
        this
      • type

        default C type​(String type)
        Sets the type of this component.
        Parameters:
        type - the type
        Returns:
        this
      • id

        default C id​(String id)
        Sets the id of this component.
        Parameters:
        id - the id
        Returns:
        this
      • augmentationKey

        default C augmentationKey​(String augmentationKey)
        Sets the augmentation key of this component.
        Parameters:
        augmentationKey - the augmentation key
        Returns:
        this
      • description

        default C description​(String descriptionKey)
        Sets the description message key for this component. If there is no matching message key, the provided string will be used as the description.
        Parameters:
        descriptionKey - the description's message key.
        Returns:
        this
      • description

        default C description​(InternationalizedMessage description)
        Sets the description message for this component.
        Parameters:
        description - the description message
        Returns:
        this
      • label

        default C label​(String labelKey)
        Sets the label message key for this component. If there is no matching message key, the provided string will be used as the label.
        Parameters:
        labelKey - the label's message key.
        Returns:
        this
      • label

        default C label​(InternationalizedMessage label)
        Sets the label message for this component.
        Parameters:
        label - the label message
        Returns:
        this
      • order

        default C order​(Integer order)
        Sets the order for this component.
        Parameters:
        order - the order
        Returns:
        this
      • scope

        default C scope​(String scope)
        Sets the scope for this component.
        Parameters:
        scope - the scope
        Returns:
        this
      • translatable

        default C translatable​(boolean translatable)
        Sets whether or not the component is translatable.
        Parameters:
        translatable - whether or not translatable
        Returns:
        this
      • translatable

        default C translatable()
        Sets this component as translatable.
        Returns:
        this
      • notTranslatable

        default C notTranslatable()
        Sets this component as not translatable.
        Returns:
        this
      • conditional

        default C conditional​(Conditional<?>... conditionals)
        Adds one or more conditions to this component.
        Parameters:
        conditionals - the condition(s)
        Returns:
        this
      • conditionals

        default C conditionals​(List<Conditional<?>> conditionals)
        Adds one or more conditions to this component.
        Parameters:
        conditionals - the condition(s)
        Returns:
        this
      • clearConditionals

        default C clearConditionals()
        Clears the current conditions on this component.
        Returns:
        this
      • attribute

        default C attribute​(String key,
                            @Nullable
                            Object value)
        Adds an attributes with the provided key and value.
        Parameters:
        key - the key
        value - the value
        Returns:
        this
      • removeAttribute

        default C removeAttribute​(String key)
        Removes the attributes at the given key.
        Parameters:
        key - the key
        Returns:
        this
      • hasAttribute

        default boolean hasAttribute​(String key)
        Returns whether or not the attribute at the given key exists.
        Parameters:
        key - the key
        Returns:
        whether or not the attribute exists
      • getAttribute

        default Object getAttribute​(String key)
        Retrieves the attribute at the given key.
        Parameters:
        key - the key
        Returns:
        the attribute value
        Throws:
        IllegalArgumentException - if no attribute exists at the key
      • getAttribute

        default <A> A getAttribute​(String key,
                                   Class<A> clazz)
        Retrieves the attribute at the given key and casts to the provided type.
        Type Parameters:
        A - the type
        Parameters:
        key - the key
        clazz - the type of attribute
        Returns:
        the attribute value
      • findAttribute

        default Optional<Object> findAttribute​(String key)
        Finds the attribute at the given key. Null-safe version of getAttribute(String).
        Parameters:
        key - the key
        Returns:
        an optional with the attribute value or empty
      • addComponent

        default C addComponent​(String key,
                               Component<?> component)
        Primary method of adding a child component. Inserts the component at the provided key into the component map.
        Parameters:
        key - the key
        component - the child component
        Returns:
        this
      • removeComponent

        default C removeComponent​(String key)
        Removes the component at the given key.
        Parameters:
        key - the key
        Returns:
        this
      • hasComponent

        default boolean hasComponent​(String key)
        Returns whether or not a child is stored at the given key.
        Parameters:
        key - the key
        Returns:
        whether or not a child exists at the key
      • getComponent

        default Component<?> getComponent​(String key)
        Retrieves the component stored at the given key, if it exists.
        Parameters:
        key - the key
        Returns:
        this
        Throws:
        IllegalArgumentException - if no component is found with that key
      • getComponent

        default <T extends Component<T>> T getComponent​(String key,
                                                        Class<T> clazz)
        Retrieves the component of the provided type stored at the given key, if it exists.
        Parameters:
        key - the key
        clazz - the type of the component
        Returns:
        this
        Throws:
        IllegalArgumentException - if no component is found with that key
      • findComponent

        default Optional<Component<?>> findComponent​(String key)
        Finds the component stored at the given key. Null-safe version of getComponent(String).
        Parameters:
        key - the key
        Returns:
        an optional of the component, or empty
      • findComponents

        default List<Component<?>> findComponents​(Predicate<Component<?>> predicate)
        Retrieves a list of child components that match the given predicate.
        Parameters:
        predicate - the predicate
        Returns:
        the matching components
      • findComponent

        default Optional<Component<?>> findComponent​(Predicate<Component<?>> predicate)
        Retrieves a single child component that matches the given predicate.
        Parameters:
        predicate - the predicate
        Returns:
        an optional with the matching component, or empty
      • hasEndpoint

        default boolean hasEndpoint​(String key)
        Returns whether or not an endpoint exists at the given key.
        Parameters:
        key - the key
        Returns:
        whether or not the endpoint exists
      • getEndpoint

        default Endpoint<?> getEndpoint​(String type)
        Retrieves the endpoint at the given type, if it exists.
        Parameters:
        type - the type
        Returns:
        the endpoint
        Throws:
        IllegalArgumentException - if the endpoint does not exist
      • getEndpoint

        default <T extends Endpoint<T>> T getEndpoint​(String type,
                                                      Class<T> clazz)
        Retrieves the endpoint at the given key as the given type.
        Type Parameters:
        T - the type
        Parameters:
        type - the type
        clazz - the type
        Returns:
        the endpoint
      • findEndpoint

        default Optional<Endpoint<?>> findEndpoint​(String type)
        Finds the endpoint stored at the given type. Null-safe version of getEndpoint(String).
        Parameters:
        type - the key
        Returns:
        an optional of the endpoint, or empty
      • findEndpoints

        default List<Endpoint<?>> findEndpoints​(Predicate<Endpoint<?>> predicate)
        Retrieves a list of endpoints that match the given predicate.
        Parameters:
        predicate - the predicate
        Returns:
        the list of matching endpoints
      • findEndpoint

        default Optional<Endpoint<?>> findEndpoint​(Predicate<Endpoint<?>> predicate)
        Retrieves a single endpoint matching the given predicate.
        Parameters:
        predicate - the predicate
        Returns:
        an optional of the matching endpoint, or empty
      • addEndpoint

        default C addEndpoint​(Endpoint<?> endpoint)
        Adds the provided endpoint to this component.
        Parameters:
        endpoint - the endpoint to add
        Returns:
        this
      • addEndpoint

        default C addEndpoint​(String type,
                              Endpoint<?> endpoint)
        Adds the provided endpoint with the given type to this component.
        Parameters:
        type - the type
        endpoint - the endpoint
        Returns:
        this
      • removeEndpoint

        default C removeEndpoint​(String type)
        Removes the endpoint with the given type.
        Parameters:
        type - the type
        Returns:
        this
      • clearEndpoints

        default C clearEndpoints()
        Clears the existing set of endpoints.
        Returns:
        this
      • addAction

        default C addAction​(Action<?> action)
        Adds an action using the action's ID as the key.
        Parameters:
        action - the action
        Returns:
        this
      • addAction

        default C addAction​(String key,
                            Action<?> action)
        Adds an action at the given key.
        Parameters:
        key - the key
        action - the action
        Returns:
        this
      • removeAction

        default C removeAction​(String key)
        Removes the action at the given key.
        Parameters:
        key - the key
        Returns:
        this
      • hasAction

        default boolean hasAction​(String key)
        Returns whether or not an action exists at the given key.
        Parameters:
        key - the key
        Returns:
        whether or not the action exists
      • getAction

        default <T extends Action<T>> T getAction​(String key,
                                                  Class<T> clazz)
        Returns the action at the provided key with the given type.
        Type Parameters:
        T - the type
        Parameters:
        key - the key
        clazz - the type
        Returns:
        the action
      • findAction

        default Optional<Action<?>> findAction​(String key)
        Finds the action at the given key. Null-safe version of getAction(String).
        Parameters:
        key - the key
        Returns:
        an optional of the action, or empty
      • findActions

        default List<Action<?>> findActions​(Predicate<Action<?>> predicate)
        Retrieves a list of actions matching the given predicate.
        Parameters:
        predicate - the predicate
        Returns:
        the list of actions matching the predicate
      • findAction

        default Optional<Action<?>> findAction​(Predicate<Action<?>> predicate)
        Retrieves a single action matching the given predicate.
        Parameters:
        predicate - the predicate
        Returns:
        an optional of the matching action, or empty