Class CIMClass
java.lang.Object
javax.cim.CIMElement
javax.cim.CIMClass
- All Implemented Interfaces:
Serializable, Comparable<CIMElement>, CIMNamedElementInterface, CIMQualifiedElementInterface
public class CIMClass
extends CIMElement
implements CIMQualifiedElementInterface, CIMNamedElementInterface
This class represents a CIM class as defined by the Distributed Management
Task Force (DMTF) CIM Infrastructure
Specification (DSP004). A
CIMClass
has the following attributes:
- an object path describing the location and name of the class
- superclass name (can be
null
if no superclass) - an array of qualifiers for the class
- an array of properties
- an array of methods
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCIMClass
(String pName, String pSuperClass, CIMQualifier<?>[] pQualifiers, CIMClassProperty<?>[] pProperties, CIMMethod<?>[] pMethods) Creates and instantiates a Java object representing a CIM Class.CIMClass
(CIMObjectPath pPath, String pSuperClass, CIMQualifier<?>[] pQualifiers, CIMClassProperty<?>[] pProperties, CIMMethod<?>[] pMethods, boolean pIsAssociation, boolean pIsKeyed) Creates and instantiates a Java object representing a CIM Class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether the specifiedCIMClass
is equal to thisCIMClass
.filterProperties
(boolean pLocalOnly, boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) This method returns a newCIMClass
with properties filtered according to the input parameters.CIMClassProperty<?>[]
getKeys()
Returns a list of key properties for this CIM class.CIMMethod
<?> getMethod
(int pIndex) Get a method by index.CIMMethod
<?> Returns the specified CIM method in this CIM class.CIMMethod
<?> Returns the CIM method specified by its name and optionally, its origin class.int
Get the number of methods defined in this CIM class.CIMMethod<?>[]
Get the CIM methods defined in this CIM class.This method returns theCIMObjectPath
that represents this CIM class.CIMClassProperty<?>[]
Get the properties defined for this CIM class.getProperty
(int pIndex) Get a class property by index.getProperty
(String pName) Gets the specified property.getProperty
(String pName, String pOriginClass) Gets the specified property.int
Get the number of properties defined in thisCIMClass
.CIMQualifier
<?> getQualifier
(int pIndex) Get a qualifier by index.CIMQualifier
<?> getQualifier
(String pName) Gets a qualifier by name.int
Get the number of qualifiers defined in this CIM class.CIMQualifier<?>[]
Returns the list of qualifiers for the CIM class.getQualifierValue
(String pName) Gets a qualifier value by name.Gets the name of the parent of this CIM class.boolean
hasQualifier
(String pName) Checks whether the specified qualifier is one of the qualifiers in this CIM class.boolean
hasQualifierValue
(String pName, Object pValue) Checks whether the specified qualifier is one of the qualifiers defined for this class with the specified value.boolean
Identifies whether or not this CIM class is an association.boolean
isKeyed()
Identifies whether or not this class is keyed.Returns a new CIM instance initialized with the default CIM properties, values and name of this CIM class.toString()
Returns aString
representation of the CIM class.Methods inherited from class CIMElement
compareTo, getName, hashCode
-
Constructor Details
-
CIMClass
public CIMClass(CIMObjectPath pPath, String pSuperClass, CIMQualifier<?>[] pQualifiers, CIMClassProperty<?>[] pProperties, CIMMethod<?>[] pMethods, boolean pIsAssociation, boolean pIsKeyed) Creates and instantiates a Java object representing a CIM Class. This method may or may not validate thepIsAssociation
andpIsKeyed
parameters. If an invalid value is supplied (i.e. the class is an association, but thepIsAssociation
was set tofalse
), it may or may not be corrected.- Parameters:
pPath
- Object Name of the CIM class.pSuperClass
- Name of the superclass.pQualifiers
- List of qualifiers of the CIM class.pProperties
- List of properties of the CIM class.pMethods
- List of methods of the CIM class.pIsAssociation
-true
if the CIM class is an Association,false
otherwise.pIsKeyed
-true
if the CIM class has Keys,false
otherwise.- Throws:
IllegalArgumentException
- If pPath is null.
-
CIMClass
public CIMClass(String pName, String pSuperClass, CIMQualifier<?>[] pQualifiers, CIMClassProperty<?>[] pProperties, CIMMethod<?>[] pMethods) Creates and instantiates a Java object representing a CIM Class. This constructor will inspect the class to determine if it is an association or has keys.- Parameters:
pName
- Name of the CIM class.pSuperClass
- Name of the superclass.pQualifiers
- List of qualifiers of the CIM class.pProperties
- List of properties of the CIM class.pMethods
- List of methods of the CIM class.- Throws:
IllegalArgumentException
- If pName is null.
-
-
Method Details
-
equals
Indicates whether the specifiedCIMClass
is equal to thisCIMClass
.- Overrides:
equals
in classCIMElement
- Parameters:
pObj
- TheCIMClass
object with which to compare.- Returns:
true
if this object is the same as thepObj
argument;false
otherwise.
-
filterProperties
public CIMClass filterProperties(boolean pLocalOnly, boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) This method returns a newCIMClass
with properties filtered according to the input parameters. Inclusion of class origin and qualifiers can also be controlled. Methods will not be included in the class returned.- Parameters:
pLocalOnly
- Iftrue
only the elements defined in this class are included; otherwise all elements are included.pIncludeQualifiers
- Iftrue
qualifiers are included on all elements; otherwise no qualifiers are included.pIncludeClassOrigin
- Iftrue
, the ClassOrigin attribute is included.pPropertyList
- If thePropertyList
input parameter is notnull
, the members of the array define one or more Property names. TheCIMClass
returned does not include elements for any Properties missing from this list. If thePropertyList
input parameter is an empty array this signifies that no Properties are included in the class returned. If thePropertyList
input parameter isnull
this specifies that all Properties are included in the class returned. If thePropertyList
contains duplicate elements or invalid property names, they are ignored.- Returns:
CIMClass
matching the requested criteria.
-
getKeys
Returns a list of key properties for this CIM class.- Returns:
- The list of CIM properties that are keys for this CIM class.
-
getMethod
Get a method by index.- Parameters:
pIndex
- The index of the method to retrieve.- Returns:
- The
CIMMethod
at the specified index. - Throws:
ArrayIndexOutOfBoundsException
-
getMethod
-
getMethod
Returns the CIM method specified by its name and optionally, its origin class. The origin class is the class in which the method is defined.- Parameters:
pName
- The string name of the method to get.pOriginClass
- (Optional) The class in which the method was defined.- Returns:
- The CIM method specified or
null
if the method does not exist.
-
getMethodCount
public int getMethodCount()Get the number of methods defined in this CIM class.- Returns:
- The number of methods defined in the CIM class.
-
getMethods
Get the CIM methods defined in this CIM class.- Returns:
- The methods in this CIM class.
-
getObjectPath
This method returns theCIMObjectPath
that represents this CIM class.- Specified by:
getObjectPath
in interfaceCIMNamedElementInterface
- Returns:
- The
CIMObjectPath
that represents this CIM class.
-
getProperties
Get the properties defined for this CIM class.- Returns:
- The properties for this class.
-
getProperty
Get a class property by index.- Parameters:
pIndex
- The index of the class property to retrieve.- Returns:
- The
CIMClassProperty
at the specified index. - Throws:
ArrayIndexOutOfBoundsException
-
getProperty
Gets 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
Gets the specified property.- 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:
- The property requested or
null
if the property does not exist.
-
getPropertyCount
public int getPropertyCount()Get the number of properties defined in thisCIMClass
.- Returns:
- The number of properties defined in the
CIMClass
.
-
getQualifier
Get a qualifier by index.- Specified by:
getQualifier
in interfaceCIMQualifiedElementInterface
- Parameters:
pIndex
- The index of the qualifier to retrieve.- Returns:
- The qualifier at the specified index.
- Throws:
ArrayIndexOutOfBoundsException
-
getQualifier
Gets a qualifier by name.- Specified by:
getQualifier
in interfaceCIMQualifiedElementInterface
- Parameters:
pName
- The name of the qualifier to get.- Returns:
- The qualifier requested or
null
if the qualifier does not exist.
-
getQualifierCount
public int getQualifierCount()Get the number of qualifiers defined in this CIM class.- Specified by:
getQualifierCount
in interfaceCIMQualifiedElementInterface
- Returns:
- The number of qualifiers defined in the CIM class.
-
getQualifiers
Returns the list of qualifiers for the CIM class.- Specified by:
getQualifiers
in interfaceCIMQualifiedElementInterface
- Returns:
- Qualifiers for this class.
-
getQualifierValue
Gets a qualifier value by name.- Specified by:
getQualifierValue
in interfaceCIMQualifiedElementInterface
- Parameters:
pName
- The name of the qualifier to get.- Returns:
null
if the qualifier does not exist or value isnull
, otherwise returns the reference to the qualifier.
-
getSuperClassName
Gets the name of the parent of this CIM class.- Returns:
- The name of the parent class.
-
hasQualifier
Checks whether the specified qualifier is one of the qualifiers in this CIM class.- Specified by:
hasQualifier
in interfaceCIMQualifiedElementInterface
- Parameters:
pName
- The name of the qualifier.- Returns:
true
if the qualifier exists in this CIM class, otherwisefalse
.
-
hasQualifierValue
Checks whether the specified qualifier is one of the qualifiers defined for this class with the specified value. This method will returnfalse
if the qualifier is not applied or if the value does not match.- Specified by:
hasQualifierValue
in interfaceCIMQualifiedElementInterface
- Parameters:
pName
- The name of the qualifier.pValue
- The value to be tested.- Returns:
true
if the qualifier exists and has the value, otherwisefalse
.
-
isAssociation
public boolean isAssociation()Identifies whether or not this CIM class is an association. An association is a relationship between two or more classes or instances of two or more classes. The properties of an association class include references, or pointers, to the two or more instances. All CIM classes can be included in one or more associations.- Returns:
true
if this CIM class is an association; otherwise,false
.
-
isKeyed
public boolean isKeyed()Identifies whether or not this class is keyed. Only keyed classes can have instances. Returnstrue
if this CIM class has one or more key properties. Otherwise, returnsfalse
.- Returns:
true
if this CIM class has a key property, otherwise returnsfalse
.
-
newInstance
Returns a new CIM instance initialized with the default CIM properties, values and name of this CIM class.- Returns:
- A CIM instance of this CIM class.
-
toString
Returns aString
representation of the CIM class. 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
.- Overrides:
toString
in classCIMElement
- Returns:
- A
String
representation of this CIM class.
-