Java Doc for ArrayType.java in  » 6.0-JDK-Core » management » javax » management » openmbean » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » management » javax.management.openmbean 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.management.openmbean.ArrayType

ArrayType
public class ArrayType extends OpenType (Code)
The ArrayType class is the open type class whose instances describe all open data values which are n-dimensional arrays of open data values.

Examples of valid ArrayType instances are:

 // 2-dimension array of java.lang.String
 ArrayType a1 = new ArrayType(2, SimpleType.STRING);
 // 1-dimension array of int
 ArrayType a2 = new ArrayType(SimpleType.INTEGER, true);
 // 1-dimension array of java.lang.Integer
 ArrayType a3 = new ArrayType(SimpleType.INTEGER, false);
 // 4-dimension array of int
 ArrayType a4 = new ArrayType(3, a2);
 // 4-dimension array of java.lang.Integer
 ArrayType a5 = new ArrayType(3, a3);
 // 1-dimension array of java.lang.String
 ArrayType a6 = new ArrayType(SimpleType.STRING, false);
 // 1-dimension array of long
 ArrayType a7 = new ArrayType(SimpleType.LONG, true);
 // 1-dimension array of java.lang.Integer
 ArrayType a8 = ArrayType.getArrayType(SimpleType.INTEGER);
 // 2-dimension array of java.lang.Integer
 ArrayType a9 = ArrayType.getArrayType(a8);
 // 2-dimension array of int
 ArrayType a10 = ArrayType.getPrimitiveArrayType(int[][].class);
 // 3-dimension array of int
 ArrayType a11 = ArrayType.getArrayType(a10);
 // 1-dimension array of float
 ArrayType a12 = ArrayType.getPrimitiveArrayType(float[].class);
 // 2-dimension array of float
 ArrayType a13 = ArrayType.getArrayType(a12);
 // 1-dimension array of javax.management.ObjectName
 ArrayType a14 = ArrayType.getArrayType(SimpleType.OBJECTNAME);
 // 2-dimension array of javax.management.ObjectName
 ArrayType a15 = ArrayType.getArrayType(a14);
 // 3-dimension array of java.lang.String
 ArrayType a16 = new ArrayType(3, SimpleType.STRING);
 // 1-dimension array of java.lang.String
 ArrayType a17 = new ArrayType(1, SimpleType.STRING);
 // 2-dimension array of java.lang.String
 ArrayType a18 = new ArrayType(1, a17);
 // 3-dimension array of java.lang.String
 ArrayType a19 = new ArrayType(1, a18);
 

since:
   1.5


Field Summary
final static  longserialVersionUID
    

Constructor Summary
public  ArrayType(int dimension, OpenType elementType)
     Constructs an ArrayType instance describing open data values which are arrays with dimension dimension of elements whose open type is elementType.

When invoked on an ArrayType instance, the OpenType.getClassName getClassName method returns the class name of the array instances it describes (following the rules defined by the Class.getName getName method of java.lang.Class), not the class name of the array elements (which is returned by a call to getElementOpenType().getClassName()).

The internal field corresponding to the type name of this ArrayType instance is also set to the class name of the array instances it describes.

public  ArrayType(SimpleType elementType, boolean primitiveArray)
     Constructs a unidimensional ArrayType instance for the supplied SimpleType .

This constructor supports the creation of arrays of primitive types when primitiveArray is true .

For primitive arrays the ArrayType.getElementOpenType() method returns the SimpleType corresponding to the wrapper type of the primitive type of the array.

When invoked on an ArrayType instance, the OpenType.getClassName getClassName method returns the class name of the array instances it describes (following the rules defined by the Class.getName getName method of java.lang.Class), not the class name of the array elements (which is returned by a call to getElementOpenType().getClassName()).

The internal field corresponding to the type name of this ArrayType instance is also set to the class name of the array instances it describes.

 ArrayType(String className, String typeName, String description, int dimension, OpenType elementType, boolean primitiveArray)
    

Method Summary
public  booleanequals(Object obj)
     Compares the specified obj parameter with this ArrayType instance for equality.

Two ArrayType instances are equal if and only if they describe array instances which have the same dimension, elements' open type and primitive array flag.
Parameters:
  obj - the object to be compared for equality with thisArrayType instance; if objis null or is not an instance of theclass ArrayType this method returnsfalse.

public static  ArrayType<E[]>getArrayType(OpenType<E> elementType)
     Create an ArrayType instance in a type-safe manner.
public  intgetDimension()
     Returns the dimension of arrays described by this ArrayType instance.
public  OpenTypegetElementOpenType()
     Returns the open type of element values contained in the arrays described by this ArrayType instance.
public static  ArrayType<T>getPrimitiveArrayType(Class<T> arrayClass)
     Create an ArrayType instance in a type-safe manner.

Calling this method twice with the same parameters may return the same object or two equal but not identical objects.

As an example, the following piece of code:

 ArrayType t = ArrayType.getPrimitiveArrayType(int[][][].class);
 System.out.println("array class name       = " + t.getClassName());
 System.out.println("element class name     = " + t.getElementOpenType().getClassName());
 System.out.println("array type name        = " + t.getTypeName());
 System.out.println("array type description = " + t.getDescription());
 
would produce the following output:
 array class name       = [[[I
 element class name     = java.lang.Integer
 array type name        = [[[I
 array type description = 3-dimension array of int
 

Parameters:
  arrayClass - a primitive array class such as int[].class , boolean[][].class , etc.
static  SimpleTypegetPrimitiveOpenType(String primitiveTypeName)
     Return the primitive open type corresponding to the given primitive type. e.g.
static  StringgetPrimitiveTypeKey(String elementClassName)
     Return the key used to identify the element type in arrays - e.g.
static  StringgetPrimitiveTypeName(String elementClassName)
     Return the primitive type name corresponding to the given wrapper class. e.g.
public  inthashCode()
     Returns the hash code value for this ArrayType instance.

The hash code of an ArrayType instance is the sum of the hash codes of all the elements of information used in equals comparisons (i.e.

 booleanisAssignableFrom(OpenType ot)
    
public  booleanisPrimitiveArray()
     Returns true if the open data values this open type describes are primitive arrays, false otherwise.
static  booleanisPrimitiveContentType(String primitiveKey)
    
public  booleanisValue(Object obj)
     Tests whether obj is a value for this ArrayType instance.

This method returns true if and only if obj is not null, obj is an array and any one of the following is true:

  • if this ArrayType instance describes an array of SimpleType elements or their corresponding primitive types, obj's class name is the same as the className field defined for this ArrayType instance (i.e.
public  StringtoString()
     Returns a string representation of this ArrayType instance.

Field Detail
serialVersionUID
final static long serialVersionUID(Code)




Constructor Detail
ArrayType
public ArrayType(int dimension, OpenType elementType) throws OpenDataException(Code)
Constructs an ArrayType instance describing open data values which are arrays with dimension dimension of elements whose open type is elementType.

When invoked on an ArrayType instance, the OpenType.getClassName getClassName method returns the class name of the array instances it describes (following the rules defined by the Class.getName getName method of java.lang.Class), not the class name of the array elements (which is returned by a call to getElementOpenType().getClassName()).

The internal field corresponding to the type name of this ArrayType instance is also set to the class name of the array instances it describes. In other words, the methods getClassName and getTypeName return the same string value. The internal field corresponding to the description of this ArrayType instance is set to a string value which follows the following template:

  • if non-primitive array: <dimension>-dimension array of <element_class_name>
  • if primitive array: <dimension>-dimension array of <primitive_type_of_the_element_class_name>

As an example, the following piece of code:

 ArrayType t = new ArrayType(3, SimpleType.STRING);
 System.out.println("array class name       = " + t.getClassName());
 System.out.println("element class name     = " + t.getElementOpenType().getClassName());
 System.out.println("array type name        = " + t.getTypeName());
 System.out.println("array type description = " + t.getDescription());
 
would produce the following output:
 array class name       = [[[Ljava.lang.String;
 element class name     = java.lang.String
 array type name        = [[[Ljava.lang.String;
 array type description = 3-dimension array of java.lang.String
 
And the following piece of code which is equivalent to the one listed above would also produce the same output:
 ArrayType t1 = new ArrayType(1, SimpleType.STRING);
 ArrayType t2 = new ArrayType(1, t1);
 ArrayType t3 = new ArrayType(1, t2);
 System.out.println("array class name       = " + t3.getClassName());
 System.out.println("element class name     = " + t3.getElementOpenType().getClassName());
 System.out.println("array type name        = " + t3.getTypeName());
 System.out.println("array type description = " + t3.getDescription());
 

Parameters:
  dimension - the dimension of arrays described by this ArrayType instance;must be greater than or equal to 1.
Parameters:
  elementType - the open type of element values containedin the arrays described by this ArrayTypeinstance; must be an instance of eitherSimpleType, CompositeType,TabularType or another ArrayTypewith a SimpleType, CompositeTypeor TabularType as its elementType.
throws:
  IllegalArgumentException - if dimension is not a positiveinteger.
throws:
  OpenDataException - if elementType's className is notone of the allowed Java class names for opendata.



ArrayType
public ArrayType(SimpleType elementType, boolean primitiveArray) throws OpenDataException(Code)
Constructs a unidimensional ArrayType instance for the supplied SimpleType .

This constructor supports the creation of arrays of primitive types when primitiveArray is true .

For primitive arrays the ArrayType.getElementOpenType() method returns the SimpleType corresponding to the wrapper type of the primitive type of the array.

When invoked on an ArrayType instance, the OpenType.getClassName getClassName method returns the class name of the array instances it describes (following the rules defined by the Class.getName getName method of java.lang.Class), not the class name of the array elements (which is returned by a call to getElementOpenType().getClassName()).

The internal field corresponding to the type name of this ArrayType instance is also set to the class name of the array instances it describes. In other words, the methods getClassName and getTypeName return the same string value. The internal field corresponding to the description of this ArrayType instance is set to a string value which follows the following template:

  • if non-primitive array: 1-dimension array of <element_class_name>
  • if primitive array: 1-dimension array of <primitive_type_of_the_element_class_name>

As an example, the following piece of code:

 ArrayType t = new ArrayType(SimpleType.INTEGER, true);
 System.out.println("array class name       = " + t.getClassName());
 System.out.println("element class name     = " + t.getElementOpenType().getClassName());
 System.out.println("array type name        = " + t.getTypeName());
 System.out.println("array type description = " + t.getDescription());
 
would produce the following output:
 array class name       = [I
 element class name     = java.lang.Integer
 array type name        = [I
 array type description = 1-dimension array of int
 

Parameters:
  elementType - the SimpleType of the element valuescontained in the arrays described by this ArrayType instance.
Parameters:
  primitiveArray - true when this array describesprimitive arrays.
throws:
  IllegalArgumentException - if dimension is not a positiveinteger.
throws:
  OpenDataException - if primitiveArray is true and elementType is not a valid SimpleType for a primitivetype.
since:
   1.6



ArrayType
ArrayType(String className, String typeName, String description, int dimension, OpenType elementType, boolean primitiveArray)(Code)




Method Detail
equals
public boolean equals(Object obj)(Code)
Compares the specified obj parameter with this ArrayType instance for equality.

Two ArrayType instances are equal if and only if they describe array instances which have the same dimension, elements' open type and primitive array flag.
Parameters:
  obj - the object to be compared for equality with thisArrayType instance; if objis null or is not an instance of theclass ArrayType this method returnsfalse. true if the specified object is equal tothis ArrayType instance.




getArrayType
public static ArrayType<E[]> getArrayType(OpenType<E> elementType) throws OpenDataException(Code)
Create an ArrayType instance in a type-safe manner.

Multidimensional arrays can be built up by calling this method as many times as necessary.

Calling this method twice with the same parameters may return the same object or two equal but not identical objects.

As an example, the following piece of code:

 ArrayType t1 = ArrayType.getArrayType(SimpleType.STRING);
 ArrayType t2 = ArrayType.getArrayType(t1);
 ArrayType t3 = ArrayType.getArrayType(t2);
 System.out.println("array class name       = " + t3.getClassName());
 System.out.println("element class name     = " + t3.getElementOpenType().getClassName());
 System.out.println("array type name        = " + t3.getTypeName());
 System.out.println("array type description = " + t3.getDescription());
 
would produce the following output:
 array class name       = [[[Ljava.lang.String;
 element class name     = java.lang.String
 array type name        = [[[Ljava.lang.String;
 array type description = 3-dimension array of java.lang.String
 

Parameters:
  elementType - the open type of element values containedin the arrays described by this ArrayTypeinstance; must be an instance of eitherSimpleType, CompositeType,TabularType or another ArrayTypewith a SimpleType, CompositeTypeor TabularType as its elementType.
throws:
  OpenDataException - if elementType's className is notone of the allowed Java class names for opendata.
since:
   1.6



getDimension
public int getDimension()(Code)
Returns the dimension of arrays described by this ArrayType instance. the dimension.



getElementOpenType
public OpenType getElementOpenType()(Code)
Returns the open type of element values contained in the arrays described by this ArrayType instance. the element type.



getPrimitiveArrayType
public static ArrayType<T> getPrimitiveArrayType(Class<T> arrayClass)(Code)
Create an ArrayType instance in a type-safe manner.

Calling this method twice with the same parameters may return the same object or two equal but not identical objects.

As an example, the following piece of code:

 ArrayType t = ArrayType.getPrimitiveArrayType(int[][][].class);
 System.out.println("array class name       = " + t.getClassName());
 System.out.println("element class name     = " + t.getElementOpenType().getClassName());
 System.out.println("array type name        = " + t.getTypeName());
 System.out.println("array type description = " + t.getDescription());
 
would produce the following output:
 array class name       = [[[I
 element class name     = java.lang.Integer
 array type name        = [[[I
 array type description = 3-dimension array of int
 

Parameters:
  arrayClass - a primitive array class such as int[].class , boolean[][].class , etc. The ArrayType.getElementOpenType() method of the returned ArrayType returns the SimpleTypecorresponding to the wrapper type of the primitivetype of the array.
throws:
  IllegalArgumentException - if arrayClass is nota primitive array.
since:
   1.6



getPrimitiveOpenType
static SimpleType getPrimitiveOpenType(String primitiveTypeName)(Code)
Return the primitive open type corresponding to the given primitive type. e.g. SimpleType.BOOLEAN for "boolean", SimpleType.CHARACTER for "char", etc...
Parameters:
  primitiveTypeName - the primitive type of the array element ("boolean", "char", etc...) the OpenType corresponding to the given primitive type name(SimpleType.BOOLEAN, SimpleType.CHARACTER, etc...)return null if the given elementClassName is not a primitivetype name.



getPrimitiveTypeKey
static String getPrimitiveTypeKey(String elementClassName)(Code)
Return the key used to identify the element type in arrays - e.g. "Z" for boolean, "C" for char etc...
Parameters:
  elementClassName - the wrapper class name of the array element ("Boolean", "Character", etc...) the key corresponding to the given type ("Z", "C", etc...)return null if the given elementClassName is not a primitivewrapper class name.



getPrimitiveTypeName
static String getPrimitiveTypeName(String elementClassName)(Code)
Return the primitive type name corresponding to the given wrapper class. e.g. "boolean" for "Boolean", "char" for "Character" etc...
Parameters:
  elementClassName - the type of the array element ("Boolean", "Character", etc...) the primitive type name corresponding to the given wrapper class ("boolean", "char", etc...)return null if the given elementClassName is not a primitivewrapper type name.



hashCode
public int hashCode()(Code)
Returns the hash code value for this ArrayType instance.

The hash code of an ArrayType instance is the sum of the hash codes of all the elements of information used in equals comparisons (i.e. dimension, elements' open type and primitive array flag). The hashcode for a primitive value is the hashcode of the corresponding boxed object (e.g. the hashcode for true is Boolean.TRUE.hashCode()). This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode() for any two ArrayType instances t1 and t2, as required by the general contract of the method Object.hashCode Object.hashCode() .

As ArrayType instances are immutable, the hash code for this instance is calculated once, on the first call to hashCode, and then the same value is returned for subsequent calls. the hash code value for this ArrayType instance




isAssignableFrom
boolean isAssignableFrom(OpenType ot)(Code)



isPrimitiveArray
public boolean isPrimitiveArray()(Code)
Returns true if the open data values this open type describes are primitive arrays, false otherwise. true if this is a primitive array type.
since:
   1.6



isPrimitiveContentType
static boolean isPrimitiveContentType(String primitiveKey)(Code)



isValue
public boolean isValue(Object obj)(Code)
Tests whether obj is a value for this ArrayType instance.

This method returns true if and only if obj is not null, obj is an array and any one of the following is true:

  • if this ArrayType instance describes an array of SimpleType elements or their corresponding primitive types, obj's class name is the same as the className field defined for this ArrayType instance (i.e. the class name returned by the OpenType.getClassName getClassName method, which includes the dimension information),
     
  • if this ArrayType instance describes an array of classes implementing the TabularData interface or the CompositeData interface, obj is assignable to such a declared array, and each element contained in obj is either null or a valid value for the element's open type specified by this ArrayType instance.

Parameters:
  obj - the object to be tested. true if obj is a value for thisArrayType instance.



toString
public String toString()(Code)
Returns a string representation of this ArrayType instance.

The string representation consists of the name of this class (i.e. javax.management.openmbean.ArrayType), the type name, the dimension, the elements' open type and the primitive array flag defined for this instance.

As ArrayType instances are immutable, the string representation for this instance is calculated once, on the first call to toString, and then the same value is returned for subsequent calls. a string representation of this ArrayType instance




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.