Class ContinuousResource

  • All Implemented Interfaces:
    Resource

    @Beta
    public final class ContinuousResource
    extends Object
    implements Resource
    Represents a resource path which specifies a resource which can be measured as continuous value. Bandwidth of a link is an example of the resource.
    • Method Detail

      • id

        public ContinuousResourceId id()
        Description copied from interface: Resource
        Returns the ID of this resource.
        Specified by:
        id in interface Resource
        Returns:
        the ID of this resource
      • simpleTypeName

        public String simpleTypeName()
        Description copied from interface: Resource
        Returns the simple type name of this resource. Example:
        Resource: DeviceId:1/PortNumber:1/VlanId:200
        Simple type name: VlanId
        Specified by:
        simpleTypeName in interface Resource
        Returns:
        the simple type name of this resource
      • isTypeOf

        public boolean isTypeOf​(Class<?> type)
        Description copied from interface: Resource
        Checks if the type of this instance is the specified type.
        Specified by:
        isTypeOf in interface Resource
        Parameters:
        type - type of resource to be checked
        Returns:
        true if this resource is the type of the specified type. Otherwise, false.
      • value

        public double value()
        Returns the value of the resource amount.
        Returns:
        the value of the resource amount
      • isSubTypeOf

        public boolean isSubTypeOf​(Class<?> ancestor)
        Description copied from interface: Resource
        Checks if the type of this instance is the sub-type of the specified type.
        Specified by:
        isSubTypeOf in interface Resource
        Parameters:
        ancestor - type of resource to be checked.
        Returns:
        true if this resource is under the resource whose type is the given type.
      • valueAs

        public <T> Optional<T> valueAs​(Class<T> type)
        Returns value interpreted as the specified type. If the specified type is incompatible with the underlying value, an empty instance is returned. A user must specify Double.class or double.class to avoid an empty value.
        Specified by:
        valueAs in interface Resource
        Type Parameters:
        T - type of the return value
        Parameters:
        type - class instance specifying the type of return value
        Returns:
        the value of this resource as the specified type. If type mismatches, returns an empty instance.
      • child

        public ContinuousResource child​(Class<?> child,
                                        double value)
        Description copied from interface: Resource
        Returns a child resource of this instance with specifying a child object and value. It is not allowed that a continuous type resource has a child. If the instance is ContinuousResource, UnsupportedOperationException is thrown.
        Specified by:
        child in interface Resource
        Parameters:
        child - child object
        value - value
        Returns:
        a child resource
      • parent

        public Optional<DiscreteResource> parent()
        Description copied from interface: Resource
        Returns the parent resource of this instance. E.g. if this resource is Link:1/VLAN ID:100, the return value is the resource for Link:1.
        Specified by:
        parent in interface Resource
        Returns:
        the parent resource of this instance. If there is no parent, empty instance will be returned.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object