Class Property.PropertyBuilder<T>

java.lang.Object
nl.pim16aap2.animatedarchitecture.core.structures.properties.Property.PropertyBuilder<T>
Type Parameters:
T - The type of the value of the property.
Enclosing class:
Property<T>

public static final class Property.PropertyBuilder<T> extends Object
Represents a builder for a property.

You can create a new property using

  • Method Details

    • build

      public Property<T> build()
      Builds the property.
      Returns:
      The newly built property.
    • withoutUserOrAdminAccess

      public Property.PropertyBuilder<T> withoutUserOrAdminAccess()
      Sets up the access levels of both users and admins to ensure neither has any kind of access to this property.

      This is the default state, so calling this method does nothing unless anything else was configured previously.

      Returns:
      This builder.
    • withUserAccessLevels

      public Property.PropertyBuilder<T> withUserAccessLevels(int userAccessLevel)
      Sets the property access level for users.
      Parameters:
      userAccessLevel - The level of access a user had over this property as a bitflag. See PropertyAccessLevel.
      Returns:
      This builder.
    • withUserAccessLevels

      public Property.PropertyBuilder<T> withUserAccessLevels(PropertyAccessLevel... levels)
      Sets the property access level for users.
      Parameters:
      levels - The level(s) of access a user should have over this property.
      Returns:
      This builder.
    • withAdminAccessLevels

      public Property.PropertyBuilder<T> withAdminAccessLevels(int adminAccessLevel)
      Sets the property access level for users.

      This is a superset of the user access level by definition.

      For example, if the user access level is 1 and the admin access level is 2, the resulting admin access level is 1 + 2.

      Parameters:
      adminAccessLevel - The level of access an admin had over this property as a bitflag. See PropertyAccessLevel.
      Returns:
      This builder.
    • withAdminAccessLevels

      public Property.PropertyBuilder<T> withAdminAccessLevels(PropertyAccessLevel... levels)
      Sets the property access level for users.

      This is a superset of the user access level by definition.

      For example, if the user access level is 1 and the admin access level is 2, the resulting admin access level is 1 + 2.

      Parameters:
      levels - The level(s) of access an admin should have over this property.
      Returns:
      This builder.
    • withPropertyScopes

      public Property.PropertyBuilder<T> withPropertyScopes(PropertyScope... propertyScopes)
      Sets the scopes in which this property is used.

      This determines which parts of the structure are affected by this property.

      For example, the Property.BLOCKS_TO_MOVE property is used in the animation scope, so changing the value of this property will clear all cached values related to the animation, such as the animation range.

      This defaults to no scopes.

      Parameters:
      propertyScopes - The scopes in which this property is used.
      Returns:
      This builder.
    • withDefaultValue

      public Property.PropertyBuilder<T> withDefaultValue(@Nullable T defaultValue)
      Sets the default value of the property.

      When the property being created is a default property for a structure type, all instances of that structure type will have this property set to the default value.

      This defaults to null.

      Parameters:
      defaultValue - The default value of the property.
      Returns:
      This builder.