Package org.onosproject.net.resource
Class DiscreteResource
- java.lang.Object
-
- org.onosproject.net.resource.DiscreteResource
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContinuousResourcechild(Class<?> child, double value)Returns a child resource of this instance with specifying a child object and value.DiscreteResourcechild(Object child)Returns a child resource of this instance with specifying the child object.booleanequals(Object obj)inthashCode()DiscreteResourceIdid()Returns the ID of this resource.booleanisSubTypeOf(Class<?> ancestor)Checks if the type of this instance is the sub-type of the specified type.booleanisTypeOf(Class<?> type)Checks if the type of this instance is the specified type.Optional<DiscreteResource>parent()Returns the parent resource of this instance.StringsimpleTypeName()Returns the simple type name of this resource.StringtoString()<T> Optional<T>valueAs(Class<T> type)Returns value interpreted as the specified type.
-
-
-
Method Detail
-
id
public DiscreteResourceId id()
Description copied from interface:ResourceReturns the ID of this resource.
-
simpleTypeName
public String simpleTypeName()
Description copied from interface:ResourceReturns the simple type name of this resource. Example:
Resource: DeviceId:1/PortNumber:1/VlanId:200
Simple type name: VlanId- Specified by:
simpleTypeNamein interfaceResource- Returns:
- the simple type name of this resource
-
isTypeOf
public boolean isTypeOf(Class<?> type)
Description copied from interface:ResourceChecks if the type of this instance is the specified type.
-
isSubTypeOf
public boolean isSubTypeOf(Class<?> ancestor)
Description copied from interface:ResourceChecks if the type of this instance is the sub-type of the specified type.- Specified by:
isSubTypeOfin interfaceResource- 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)
Description copied from interface:ResourceReturns value interpreted as the specified type. If the specified type is incompatible with the underlying value, an empty instance is returned.
-
child
public DiscreteResource child(Object child)
Description copied from interface:ResourceReturns a child resource of this instance with specifying the child object. It is not allowed that a continuous type resource has a child. If the instance is ContinuousResource,UnsupportedOperationExceptionis thrown. If the given object is aClassinstance,IllegalArgumentExceptionis thrown.
-
child
public ContinuousResource child(Class<?> child, double value)
Description copied from interface:ResourceReturns 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,UnsupportedOperationExceptionis thrown.
-
parent
public Optional<DiscreteResource> parent()
Description copied from interface:ResourceReturns 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.
-
-