Package Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Package objects contain version information
about the implementation and specification of a Java package.
[Android.Runtime.Register("java/lang/Package", DoNotGenerateAcw=true)]
public class Package : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.Reflect.IAnnotatedElement
[<Android.Runtime.Register("java/lang/Package", DoNotGenerateAcw=true)>]
type Package = class
inherit Object
interface IAnnotatedElement
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Inheritance
- Attributes
- Implements
Remarks
Package objects contain version information about the implementation and specification of a Java package. This versioning information is retrieved and made available by the ClassLoader instance that loaded the class(es). Typically, it is stored in the manifest that is distributed with the classes.
The set of classes that make up the package may implement a particular specification and if so the specification title, version number, and vendor strings identify that specification. An application can ask if the package is compatible with a particular version, see the #isCompatibleWith isCompatibleWith method for details.
Specification version numbers use a syntax that consists of nonnegative decimal integers separated by periods ".", for example "2.0" or "1.2.3.4.5.6.7". This allows an extensible number to be used to represent major, minor, micro, etc. versions. The version specification is described by the following formal grammar: <blockquote> <dl> <dt>SpecificationVersion:<dd>Digits RefinedVersion<sub>opt</sub><dt>RefinedVersion:<dd>.Digits<dd>.Digits RefinedVersion<dt>Digits:<dd>Digit<dd>Digits<dt>Digit:<dd>any character for which Character#isDigit returns true, e.g. 0, 1, 2, ... </dl> </blockquote>
The implementation title, version, and vendor strings identify an implementation and are made available conveniently to enable accurate reporting of the packages involved when a problem occurs. The contents all three implementation strings are vendor specific. The implementation version strings have no specified syntax and should only be compared for equality with desired version identifiers.
Within each ClassLoader instance all classes from the same java package have the same Package object. The static methods allow a package to be found by name or the set of all packages known to the current class loader to be found.
Java documentation for java.lang.Package.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
| Name | Description |
|---|---|
| Package(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
Properties
| Name | Description |
|---|---|
| Class |
Returns the runtime class of this |
| Handle |
The handle to the underlying Android instance. (Inherited from Object) |
| ImplementationTitle |
Return the title of this package. |
| ImplementationVendor |
Returns the name of the organization, vendor or company that provided this implementation. |
| ImplementationVersion |
Return the version of this implementation. |
| IsSealed |
Returns true if this package is sealed. |
| JniIdentityHashCode |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniPeerMembers |
Gets the JNI metadata used to invoke members of this Java peer. |
| Name |
Return the name of this package. |
| PeerReference |
Gets the JNI object reference for this Java peer. (Inherited from Object) |
| SpecificationTitle |
Return the title of the specification that this package implements. |
| SpecificationVendor |
Return the name of the organization, vendor, or company that owns and maintains the specification of the classes that implement this package. |
| SpecificationVersion |
Returns the version number of the specification that this package implements. |
| ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
| ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
Methods
| Name | Description |
|---|---|
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| Dispose() |
Releases the resources held by this Java peer. (Inherited from Object) |
| Dispose(Boolean) |
Releases the resources held by this Java peer. (Inherited from Object) |
| Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
| GetAnnotation(Class) |
Added in 1. |
| GetAnnotations() |
Added in 1. |
| GetAnnotationsByType(Class) |
Added in 1. |
| GetDeclaredAnnotation(Class) |
Added in 1. |
| GetDeclaredAnnotations() |
Added in 1. |
| GetDeclaredAnnotationsByType(Class) |
Added in 1. |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
| GetPackage(String) |
Find a package by name in the callers |
| GetPackages() |
Get all the packages currently known for the caller's |
| InvokeIsSealed(URL) |
Returns true if this package is sealed with respect to the specified code source url. |
| IsAnnotationPresent(Class) |
Determines whether an annotation of the requested type is present on this package. |
| IsCompatibleWith(String) |
Compare this package's specification version with a desired version. |
| JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
| Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
| NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
| SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
| ToArray<T>() |
Creates a managed array from this Java array wrapper. (Inherited from Object) |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (Inherited from Object) |
| Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
| Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IJavaPeerable.Disposed() |
Notifies the interop runtime that this managed peer has been disposed. (Inherited from Object) |
| IJavaPeerable.DisposeUnlessReferenced() |
Releases this Java peer unless it is retained by another managed reference. (Inherited from Object) |
| IJavaPeerable.Finalized() |
Notifies the interop runtime that this managed peer has been finalized. (Inherited from Object) |
| IJavaPeerable.JniManagedPeerState |
Gets the state that describes the relationship between this managed peer and its JNI reference. (Inherited from Object) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) |
Sets the interop identity hash code for this Java peer. (Inherited from Object) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) |
Sets the managed and JNI peer state for this Java peer. (Inherited from Object) |
| IJavaPeerable.SetPeerReference(JniObjectReference) |
Sets the JNI object reference used by this managed peer. (Inherited from Object) |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) | |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |