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 ContinuousResource
child(java.lang.Class<?> child, double value)
Returns a child resource of this instance with specifying a child object and value.DiscreteResource
child(java.lang.Object child)
Returns a child resource of this instance with specifying the child object.boolean
equals(java.lang.Object obj)
int
hashCode()
DiscreteResourceId
id()
Returns the ID of this resource.boolean
isSubTypeOf(java.lang.Class<?> ancestor)
Checks if the type of this instance is the sub-type of the specified type.boolean
isTypeOf(java.lang.Class<?> type)
Checks if the type of this instance is the specified type.java.util.Optional<DiscreteResource>
parent()
Returns the parent resource of this instance.java.lang.String
simpleTypeName()
Returns the simple type name of this resource.java.lang.String
toString()
<T> java.util.Optional<T>
valueAs(java.lang.Class<T> type)
Returns value interpreted as the specified type.
-
-
-
Method Detail
-
id
public DiscreteResourceId id()
Description copied from interface:Resource
Returns the ID of this resource.
-
simpleTypeName
public java.lang.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 interfaceResource
- Returns:
- the simple type name of this resource
-
isTypeOf
public boolean isTypeOf(java.lang.Class<?> type)
Description copied from interface:Resource
Checks if the type of this instance is the specified type.
-
isSubTypeOf
public boolean isSubTypeOf(java.lang.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 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> java.util.Optional<T> valueAs(java.lang.Class<T> type)
Description copied from interface:Resource
Returns 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(java.lang.Object child)
Description copied from interface:Resource
Returns 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,UnsupportedOperationException
is thrown. If the given object is aClass
instance,IllegalArgumentException
is thrown.
-
child
public ContinuousResource child(java.lang.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.
-
parent
public java.util.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.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-