xp-framework/rfc — Issue #117: New Package class
Author: thekid
Created: 2011-10-17 15:56:02+00:00
State: closed
Labels: framework, implemented

Scope of Change
====
A new class named "Package" will be added to the lang.reflect package.

Rationale
====
- Create a named wrapper for situations in which we classpaths are passed
around.
- Get rid of directory traversal in places where we need a list of all
classes in a certain package (e.g., webservices list)

Functionality
====

Package API
----

```php

*/
public string toString() { ... }

/**
* Checks whether a given object is equal to this Package instance.
*
*/
public bool equals(Generic $cmp) { ... }

/**
* Creates a hashcode for this package
*
*/
public string hashCode() { ... }
}
?>
```

Examples
----
Get all classes in a certain package:

```php
getClasses() as $class) {
Console::writeLine('- ', $class->getName());
}
?>
```

Security considerations
====
n/a

Speed impact
====
n/a

Dependencies
====
- xp-framework/rfc #121

- A getPackage() method will be added to lang.XPClass.

Related documents
====
- http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Package.html