jfun.jaskell.classloader
Class SimpleLoadingPolicy

java.lang.Object
  extended byjfun.jaskell.classloader.SimpleLoadingPolicy
All Implemented Interfaces:
LoadingPolicy

public class SimpleLoadingPolicy
extends java.lang.Object
implements LoadingPolicy

A simple mutable implementation of LoadingPolicy interface.

Zephyr Business Solution

Author:
Ben Yu

Constructor Summary
SimpleLoadingPolicy()
          Create a SimpleLoadingPolicy object.
 
Method Summary
 void addChildFirstRoot(java.lang.String name)
          Adds a package prefix for child-first.
 void addChildOnlyRoot(java.lang.String name)
          Adds a package prefix for child-only.
 void addParentFirstRoot(java.lang.String name)
          Adds a package prefix for parent-first.
 void addParentOnlyRoot(java.lang.String name)
          Adds a package prefix for parent-only.
 void addSystemRoot(java.lang.String name)
          Adds a package prefix as a system package so that it is guaranteed to be loaded parent-first even if child-first is set for global setting.
 boolean isChildOnly(java.lang.String name)
          This is the third priority.
 boolean isParentFirst(java.lang.String name)
          The lowest priority parameter.
 boolean isParentOnly(java.lang.String name)
          This is the highest priority.
 boolean isSystem(java.lang.String name)
          This is the second priority.
 void notChildOnlyRoot(java.lang.String name)
          Adds a package prefix to exclude for child-only.
 void notParentOnlyRoot(java.lang.String name)
          Adds a package prefix to exclude for parent-only.
 void notSystemRoot(java.lang.String name)
          Adds a package prefix to exclude for system package.
 void setChildOnly(boolean v)
          Sets the child-only option.
 void setParentFirst(boolean v)
          Sets the parent-first option.
 void setParentOnly(boolean v)
          Sets the parent-only option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLoadingPolicy

public SimpleLoadingPolicy()
Create a SimpleLoadingPolicy object. The system libraries including neptune packages are added to system package roots.

Method Detail

isParentFirst

public boolean isParentFirst(java.lang.String name)
Description copied from interface: LoadingPolicy
The lowest priority parameter. If true, the parent class is consuled first.

Specified by:
isParentFirst in interface LoadingPolicy
Parameters:
name - the class or resource name.
Returns:
is it parent first?

isParentOnly

public boolean isParentOnly(java.lang.String name)
Description copied from interface: LoadingPolicy
This is the highest priority. if true, the class is only loaded from parent.

Specified by:
isParentOnly in interface LoadingPolicy
Parameters:
name - the class or resource name.
Returns:
is it parent only?

isSystem

public boolean isSystem(java.lang.String name)
Description copied from interface: LoadingPolicy
This is the second priority. if true, the parent is always consulted first, even if it is child only.

Specified by:
isSystem in interface LoadingPolicy
Parameters:
name - the class or resource name.
Returns:
is it a system resource/class?

isChildOnly

public boolean isChildOnly(java.lang.String name)
Description copied from interface: LoadingPolicy
This is the third priority. if true, the parent is ignored.

Specified by:
isChildOnly in interface LoadingPolicy
Parameters:
name - the class or resource name.
Returns:
is it child only?

setParentFirst

public void setParentFirst(boolean v)
Sets the parent-first option.

Parameters:
v - true if parent-first, false otherwise.

setParentOnly

public void setParentOnly(boolean v)
Sets the parent-only option.

Parameters:
v - true if parent-only, false otherwise.

setChildOnly

public void setChildOnly(boolean v)
Sets the child-only option.

Parameters:
v - true if child-only, false otherwise.

addParentFirstRoot

public void addParentFirstRoot(java.lang.String name)
Adds a package prefix for parent-first. All resources and classes under this package and sub-packages will use parent-first, even if the global parent-first option is not set.

Parameters:
name - the package root.

addChildFirstRoot

public void addChildFirstRoot(java.lang.String name)
Adds a package prefix for child-first. All resources and classes under this package and sub-packages will use child-first, even if the global child-first option is not set.

Parameters:
name - the package root.

addParentOnlyRoot

public void addParentOnlyRoot(java.lang.String name)
Adds a package prefix for parent-only. All resources and classes under this package and sub-packages will use parent-only, even if the global parent-only option is not set.

Parameters:
name - the package root.

addChildOnlyRoot

public void addChildOnlyRoot(java.lang.String name)
Adds a package prefix for child-only. All resources and classes under this package and sub-packages will use child-only, even if the global child-only option is not set.

Parameters:
name - the package root.

notChildOnlyRoot

public void notChildOnlyRoot(java.lang.String name)
Adds a package prefix to exclude for child-only. This takes precedence over addChildOnlyRoot().

Parameters:
name - the package root.

notParentOnlyRoot

public void notParentOnlyRoot(java.lang.String name)
Adds a package prefix to exclude for parent-only. This takes precedence over addParentOnlyRoot().

Parameters:
name - the package root.

addSystemRoot

public void addSystemRoot(java.lang.String name)
Adds a package prefix as a system package so that it is guaranteed to be loaded parent-first even if child-first is set for global setting.

Parameters:
name - the package root.

notSystemRoot

public void notSystemRoot(java.lang.String name)
Adds a package prefix to exclude for system package. This takes precedence over addSystemRoot().

Parameters:
name - the package root.