All Implemented Interfaces:
Iterable<Attribute>, AttributeContainer<MapAttributeValue>, AttributeOrAttributeValue<AttributeValue>, AttributeValue

public class Device extends ComplexAttributeValue<Device>
This class wraps DeviceAttributes into a ComplexAttributeValue, allowing it to be treated as part of an account (as multi-valued attribute).
  • Constructor Details

  • Method Details

    • of

      public static Device of(DeviceAttributes deviceAttributes)
      Creates a new Device object from a set of DeviceAttributes.
      Parameters:
      deviceAttributes - the DeviceAttributes to use when creating the new Device object
      Returns:
      the new Device object
    • of

      public static Device of(MapAttributeValue mapAttributeValue)
      Creates a new Device object from a MapAttributeValue after wrapping that in DeviceAttributes.

      The values of the MapAttributeValue should be the public members of DeviceAttributes (e.g., DEVICE_ID, ACCOUNT_ID, etc.). Any unknown attributes will simply be ignored.

      Parameters:
      mapAttributeValue - a map of name/values pairs to use to create the Device
      Returns:
      the new Device object
    • of

      public static Device of(Iterable<Attribute> attributes)
      Creates a new Device object from an Iterable of Attribute objects.

      As the Device object is created, the attributes are wrapped in a DeviceAttributes object. Consequently, the attributes should have the names that correspond to the public members of DeviceAttributes (e.g., DEVICE_ID, ACCOUNT_ID, etc.). Any unknown attributes will simply be ignored.

      Parameters:
      attributes - the attributes of the new Device
      Returns:
      a new Device object
    • copyOf

      protected Device copyOf(MapAttributeValue mapAttributeValue)
      Copies the DeviceAttributes from a MapAttributeValue object to form a new Device object.

      Any unknown attributes will simply be ignored. The prototypical usage of this method looks like this:

      Device.copyOf(MapAttributeValue.of(DeviceAttributes.toMap()));
      Specified by:
      copyOf in class ComplexAttributeValue<Device>
      Parameters:
      mapAttributeValue - a map of name/values pairs to use to create the Device
      Returns:
      a new Device object consisting of a copy of the device-related attributes in the given map of attributes
    • asDeviceAttributes

      public DeviceAttributes asDeviceAttributes()
      Get this device represented as DeviceAttributes
      Returns:
      this device represented as DeviceAttributes
    • getId

      public String getId()
      Get the (unique) ID of this device.
      Returns:
      the ID of this device
    • getExternalId

      @Nullable public @Nullable String getExternalId()
      Get the external ID of this device
      Returns:
      the external ID of this device
    • getMeta

      @Nullable public @Nullable Meta getMeta()
      Get the (SCIM compatible) metadata of this device.
      Returns:
      the meta data of this device
    • getDeviceId

      public String getDeviceId()
      Get the ID of this device.
      Returns:
      the ID of the device
    • getSchemas

      public List<String> getSchemas()
      Get the schemas used in these device attributes.
      Returns:
      the schemas used in these device attributes
    • getAccountId

      @Nullable public @Nullable String getAccountId()
      Get the ID of the account this device belongs to.
      Returns:
      the account ID associated with this device.
    • getAlias

      @Nullable public @Nullable String getAlias()
      Get the alias of this device.
      Returns:
      the alias of this device
    • getFormFactor

      @Nullable public @Nullable String getFormFactor()
      Get the form factor of this device (e.g. tablet, phone..)
      Returns:
      the form factor of this device
    • getNumber

      @Nullable public @Nullable String getNumber()
      Get the number of the device (alias for getExternalId())
      Returns:
      the external ID of the device
    • getDeviceType

      @Nullable public @Nullable String getDeviceType()
      Get the type of this device.
      Returns:
      the type of this device
    • getExpiresAt

      @Nullable public @Nullable Instant getExpiresAt()
      Get the instant where this device expires.
      Returns:
      the instant where this device expires
    • getOwner

      @Nullable public @Nullable String getOwner()
      Get the owner (as in username) of this device.
      Returns:
      the owner of this device
    • getAttributes

      public DeviceAttributes getAttributes()
      Get the attributes of this device.
      Returns:
      the attributes of this device
    • nullOrOfType

      protected static <T> T nullOrOfType(Class<T> type, @Nullable Object object)