Skip to content

2. Packages

Anindya Bandopadhyay edited this page Jan 18, 2018 · 1 revision

Packages

The developer defines package same as we do it in Java but here we have some extra features like pattern matching.

Package name pattern matching

  1. An asterisk (*), matches any number of characters (including none).
  2. Two asterisks (**), works like * but crosses directory boundaries. This syntax is generally used for matching complete paths.
  3. A question mark (?), matches exactly one character.

Rules

  1. Package definition cannot start with wildchar "*".
  2. If developer defining class then it must end with .class extension. ("org.pojotester.testing.mypack.MyClass.class")

Example of valid package

  • "org.pojotester.testing.mypack"
  • "org.pojotester.testing.mypack.MyClass.class"
  • "org.**.mypack"
  • "org.pojo*.testing.mypack"
  • "org.pojotester.testing.mypack.?yClass.class"
Clone this wiki locally