Package javax.cim
Class CIMInstance
java.lang.Object
javax.cim.CIMInstance
- All Implemented Interfaces:
Serializable
,CIMNamedElementInterface
This class represents a CIM instance as defined by the Distributed Management
Task Force (DMTF) CIM Infrastructure
Specification (DSP004).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCIMInstance
(CIMObjectPath pName, CIMProperty<?>[] pProps) Constructs aCIMInstance
object using the name and properties specified. -
Method Summary
Modifier and TypeMethodDescriptionderiveInstance
(CIMObjectPath pPath) Returns a CIMInstance with the updatedCIMObjectPath
.deriveInstance
(CIMProperty<?>[] pPropA) Returns aCIMInstance
with the updated values for the properties inpPropA
.boolean
Indicates whether some other instance is equal to this one.filterProperties
(boolean pLocalOnly, boolean pIncludeClassOrigin, String[] pPropertyList) This method returns a newCIMInstance
with properties filtered according to the input parameters.Get the name of the class that instantiates this CIM instance.CIMProperty<?>[]
getKeys()
Get the key properties for this instance.Returns theCIMObjectPath
that represents this instance.CIMProperty<?>[]
Retrieve an array of the properties for this instance.CIMProperty
<?> getProperty
(int pIndex) Get a class property by index.CIMProperty
<?> getProperty
(String pName) Returns the specified property.CIMProperty
<?> getProperty
(String pName, String pOriginClass) Returns the specifiedCIMProperty
.int
Get the number of properties defined in thisCIMInstance
.getPropertyValue
(String name) Returns the value of a property of this CIM Instance.int
hashCode()
Computes the hash code for this instance.toString()
Returns aString
representation of theCIMInstance
.
-
Constructor Details
-
CIMInstance
Constructs aCIMInstance
object using the name and properties specified.- Parameters:
pName
- TheCIMObjectPath
for thisCIMInstance
.pProps
- The properties for thisCIMInstance
.- Throws:
IllegalArgumentException
- IfpName
isnull
orpName.getObjectName()
isnull
.
[OPTIONAL] - If the key property values do not match the values in the property array. This is optional due to the cost of the verification. Some implementations may leave it up to the developer to ensure that the values match.
-
-
Method Details
-
deriveInstance
Returns a CIMInstance with the updatedCIMObjectPath
.- Parameters:
pPath
- The completeCIMObjectPath
for this instance.- Returns:
- A new
CIMInstance
with the updatedCIMObjectPath
.
-
deriveInstance
Returns aCIMInstance
with the updated values for the properties inpPropA
. Any new properties are ignored.- Parameters:
pPropA
- The array of properties to update.- Returns:
- A new instance with the updated properties.
-
equals
Indicates whether some other instance is equal to this one. TwoCIMInstances
are considered equal if the names are the same. This method does NOT compare each property value. -
filterProperties
public CIMInstance filterProperties(boolean pLocalOnly, boolean pIncludeClassOrigin, String[] pPropertyList) This method returns a newCIMInstance
with properties filtered according to the input parameters. Inclusion of class origin and qualifiers can also be controlled.- Parameters:
pLocalOnly
- Include only the properties values that were instantiated in this instance.pIncludeClassOrigin
- classOrigins are only included iftrue
.pPropertyList
- If thepPropertyList
input parameter is notnull
, the members of the array define one or more Property names. The returned Instance does not include elements for any Properties missing from this list. If thepPropertyList
input parameter is an empty array this signifies that no Properties are included in each returned class. If thepPropertyList
input parameter isnull
this specifies that all Properties are included in each returned class. If thepPropertyList
contains duplicate elements or invalid property names, they are ignored.- Returns:
CIMInstance
matching the input filter.
-
getClassName
Get the name of the class that instantiates this CIM instance.- Returns:
- Name of class that instantiates this CIM instance.
-
getKeys
Get the key properties for this instance.- Returns:
- An array of key properties.
-
getObjectPath
Returns theCIMObjectPath
that represents this instance.- Specified by:
getObjectPath
in interfaceCIMNamedElementInterface
- Returns:
- The
CIMObjectPath
that represents this instance.
-
getProperties
Retrieve an array of the properties for this instance.- Returns:
- An array of the CIM properties for this instance.
-
getProperty
Get a class property by index.- Parameters:
pIndex
- The index of the class property to retrieve.- Returns:
- The
CIMProperty
at the specified index. - Throws:
ArrayIndexOutOfBoundsException
-
getProperty
Returns the specified property.- Parameters:
pName
- The text string for the name of the property.- Returns:
- The property requested or
null
if the property does not exist.
-
getProperty
Returns the specifiedCIMProperty
.- Parameters:
pName
- The string name of the property to get.pOriginClass
- (Optional) The string name of the class in which the property was defined.- Returns:
null
if the property does not exist, otherwise returns the CIM property.
-
getPropertyCount
public int getPropertyCount()Get the number of properties defined in thisCIMInstance
.- Returns:
- The number of properties defined in the
CIMInstance
.
-
getPropertyValue
Returns the value of a property of this CIM Instance.- Parameters:
name
- The name of the property.- Returns:
- The value for the specified property name or
null
if the property does not exist.
-
hashCode
public int hashCode()Computes the hash code for this instance. The hash code will be the object path of the instance not including the host or namespace information. -
toString
Returns aString
representation of theCIMInstance
. This method is intended to be used only for debugging purposes, and the format of the returned string may vary between implementations. The returned string may be empty but may not benull
.
-