com.lizardtech.djvu
Class DjVuObject

java.lang.Object
  extended by com.lizardtech.djvu.DjVuObject
All Implemented Interfaces:
DjVuInterface
Direct Known Subclasses:
DataPool, DjVmDir, DjVuAnno, DjVuInfo, DjVuPage, DjVuText, Document, GMap, GRect, IWPixmap, JB2Codec, JB2Dict, Palette, Rect, ZPCodec

public class DjVuObject
extends java.lang.Object
implements DjVuInterface

This is a basic implimentation of the DjVuInterface. Children should have a static method for creating an instance of the class using the referenced object to initialize DjVuObjects storage.

Version:
$Revision: 1.10 $
Author:
Bill C. Riemers

Field Summary
static boolean hasReferences
          This flag indicates if references are available.
 
Constructor Summary
DjVuObject()
           
 
Method Summary
static void checkLockTime(long lockTime, long maxTime)
           
static DjVuInterface create(DjVuOptions options, java.lang.Class bestClass, java.lang.Class defaultClass)
          Creates the desired class.
static DjVuInterface create(DjVuOptions options, java.lang.Class bestClass, java.lang.String className)
          Creates the desired class.
static java.lang.Object createSoftReference(java.lang.Object value, java.lang.Object defaultValue)
          Create a new SoftReference, if supported.
static java.lang.Object createWeakReference(java.lang.Object value, java.lang.Object defaultValue)
          Create a new WeakReference, if supported.
 DjVuOptions getDjVuOptions()
          Query the DjVuOptions used by this object.
static java.lang.Object getFromReference(java.lang.Object value)
          Retrieve the value from a reference.
static java.lang.Object invoke(java.lang.reflect.Method method, java.lang.Object o, java.lang.Object[] args)
          This is a wrapper for method.invoke that catches and reports exceptions.
 void setDjVuOptions(DjVuOptions options)
          Set the DjVuOptions to be used by this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hasReferences

public static final boolean hasReferences
This flag indicates if references are available.

Constructor Detail

DjVuObject

public DjVuObject()
Method Detail

setDjVuOptions

public void setDjVuOptions(DjVuOptions options)
Set the DjVuOptions to be used by this object.

Specified by:
setDjVuOptions in interface DjVuInterface
Parameters:
options - DjVuOptions to use.

getDjVuOptions

public DjVuOptions getDjVuOptions()
Query the DjVuOptions used by this object.

Specified by:
getDjVuOptions in interface DjVuInterface
Returns:
DjVuOptions in use

getFromReference

public static java.lang.Object getFromReference(java.lang.Object value)
Retrieve the value from a reference. If the specified object is not a reference then that value will be returned.

Parameters:
value - The reference to query.
Returns:
The value contained by the reference.

create

public static DjVuInterface create(DjVuOptions options,
                                   java.lang.Class bestClass,
                                   java.lang.String className)
Creates the desired class. bestClass is not null, it will be created. Otherwise the named class will be created. If the creation fails, a null will be returned.

Parameters:
options - the DjVuOptions instance the new object should use.
bestClass - The class we wish to create.
className - The name of the class to create as default.
Returns:
the newly created object

create

public static DjVuInterface create(DjVuOptions options,
                                   java.lang.Class bestClass,
                                   java.lang.Class defaultClass)
Creates the desired class. bestClass is not null, it will be created. Otherwise the named class will be created. If the creation fails, a null will be returned.

Parameters:
options - the DjVuOptions instance the new object should use.
bestClass - The class we wish to create.
defaultClass - The class to create as default.
Returns:
the newly created object

createSoftReference

public static java.lang.Object createSoftReference(java.lang.Object value,
                                                   java.lang.Object defaultValue)
Create a new SoftReference, if supported.

Parameters:
value - The value to wrap in a soft reference.
defaultValue - The value to return if soft references are not supported.
Returns:
The soft reference, or default value.

createWeakReference

public static java.lang.Object createWeakReference(java.lang.Object value,
                                                   java.lang.Object defaultValue)
Create a new WeakReference, if supported.

Parameters:
value - The value to wrap in a weak reference.
defaultValue - The value to return if weak references are not supported.
Returns:
The weak reference, or default value.

invoke

public static java.lang.Object invoke(java.lang.reflect.Method method,
                                      java.lang.Object o,
                                      java.lang.Object[] args)
This is a wrapper for method.invoke that catches and reports exceptions.

Parameters:
method - class method to invoke
o - the object to invoke the method on
args - the arguments to send to the method
Returns:
the method.invoke return value or null

checkLockTime

public static void checkLockTime(long lockTime,
                                 long maxTime)