com.vinculumtech.carrierwave.image
Class ImageHelper

java.lang.Object
  extended bycom.vinculumtech.carrierwave.image.ImageHelper

public final class ImageHelper
extends java.lang.Object

The ImageHelper class provides a set of utilities to manipulate Image instances. Specifically it should be used to access protected members of the Image class for testing, or for accessing meta-data on a particular Image subclass.

Version:
$Id: //depot/carrierwave/src/shared/com/vinculumtech/carrierwave/image/ImageHelper.java#15 $

Constructor Summary
ImageHelper()
           
 
Method Summary
static java.lang.Object buildArray(java.lang.Class imageClass, java.lang.String fieldName, java.lang.Class componentType)
          Used by all Image subtypes to initialize meta-info arrays.
static Image clone(Image image)
          Convenience method for cloning images without catching the exceptions.
static java.util.List cloneContainer(Image parent, java.util.List objects)
          Used by Image subclasses to clone container instances.
static java.util.Map cloneContainer(Image parent, java.util.Map objects)
          Used by Image subclasses to clone container instances.
static java.util.List cloneContainer(java.util.List objects)
          Used by Image subclasses to clone container instances.
static java.util.Map cloneContainer(java.util.Map objects)
          Used by Image subclasses to clone container instances.
static Image copyImage(Image originalImage, boolean keepImageableIdentity)
          Returns a clone of the given Image instance.
The given Image instance is given a new identity unless keepIdenity is true.
static Image copyImage(Image originalImage, boolean keepImageableIdentity, boolean keepImageIdentity)
          Returns a clone of the given Image instance.
Image instances have Imageable identity if they are reflected (via a 'select') from a remote Imageable instance.
static Image copyLiterals(Image originalImage)
          Copies the given image.
static int countParents(Icon icon)
           
static int countParents(Image image)
           
static int findIndexOf(Image image, java.lang.String edgeName)
           
static boolean[] getDependentEdgesFrom(java.lang.Class imageType)
           
static boolean[] getDependentEdgesFrom(java.lang.String imageType)
           
static java.lang.String[] getEdgeImageTypesFrom(java.lang.Class imageType)
           
static java.lang.String[] getEdgeImageTypesFrom(java.lang.String imageType)
           
static java.lang.String[] getEdgesFrom(java.lang.Class imageType)
           
static java.lang.String[] getEdgesFrom(java.lang.String imageType)
           
static java.lang.String[] getEdgeTypesFrom(java.lang.Class imageType)
           
static java.lang.String[] getEdgeTypesFrom(java.lang.String imageType)
           
static java.lang.String getImageableTypeFrom(java.lang.Class imageType)
           
static java.lang.String getImageableTypeFrom(java.lang.String imageType)
           
static java.lang.String getImageInterfaceTypeFrom(java.lang.Class imageType)
           
static java.lang.String getImageInterfaceTypeFrom(java.lang.String imageType)
           
static java.lang.String[] getLiteralsFrom(java.lang.Class imageType)
           
static java.lang.String[] getLiteralsFrom(java.lang.String imageType)
           
static java.lang.String[] getLiteralTypesFrom(java.lang.Class imageType)
           
static java.lang.String[] getLiteralTypesFrom(java.lang.String imageType)
           
static boolean[] getReadOnlyEdgesFrom(java.lang.Class imageType)
           
static boolean[] getReadOnlyEdgesFrom(java.lang.String imageType)
           
static boolean[] getReadOnlyLiteralsFrom(java.lang.Class imageType)
           
static boolean[] getReadOnlyLiteralsFrom(java.lang.String imageType)
           
static boolean[] getReferenceOnlyEdgesFrom(java.lang.Class imageType)
           
static boolean[] getReferenceOnlyEdgesFrom(java.lang.String imageType)
           
static Icon iconOf(java.lang.Object object)
          Returns the given object as an Icon.
static boolean isDependentImage(java.lang.Class imageType)
           
static boolean isDependentImage(java.lang.String imageType)
           
static void setIconOn(Image image, Icon icon)
          setIcon is not public on image to prevent certain classes of errors, but there are cases where it is necessary or helpful.
static void setIsDirtyOn(Image image, boolean isDirty)
          setIsDirtyOn is not public on image to prevent certain classes of errors, but there are cases where it is necessary or helpful.
static void setIsReflectionOn(Image image, boolean isReflection)
          setIsReflection is not public on image to prevent certain classes of errors, but there are cases where it is necessary or helpful.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageHelper

public ImageHelper()
Method Detail

setIconOn

public static final void setIconOn(Image image,
                                   Icon icon)
setIcon is not public on image to prevent certain classes of errors, but there are cases where it is necessary or helpful.


setIsReflectionOn

public static final void setIsReflectionOn(Image image,
                                           boolean isReflection)
setIsReflection is not public on image to prevent certain classes of errors, but there are cases where it is necessary or helpful.


setIsDirtyOn

public static final void setIsDirtyOn(Image image,
                                      boolean isDirty)
setIsDirtyOn is not public on image to prevent certain classes of errors, but there are cases where it is necessary or helpful.


iconOf

public static final Icon iconOf(java.lang.Object object)
Returns the given object as an Icon. If object is type Icon, it is returned. If object is an Image instance, its icon is returned. Otherwise an IllegalArgumentException is thrown.


copyLiterals

public static final Image copyLiterals(Image originalImage)
Copies the given image. Only values retained are the literal values. IconHelper is lost.


clone

public static final Image clone(Image image)
Convenience method for cloning images without catching the exceptions.

Parameters:
image -
Returns:
The cloned image

countParents

public static final int countParents(Image image)
Parameters:
image -
Returns:
the number of parents this Image has

countParents

public static final int countParents(Icon icon)
Parameters:
icon -
Returns:
the number of parents this Icon has

buildArray

public static final java.lang.Object buildArray(java.lang.Class imageClass,
                                                java.lang.String fieldName,
                                                java.lang.Class componentType)
Used by all Image subtypes to initialize meta-info arrays.

Parameters:
imageClass -
fieldName -
componentType -
Returns:
an Array of componentTypes

cloneContainer

public static final java.util.Map cloneContainer(java.util.Map objects)
Used by Image subclasses to clone container instances.

Parameters:
objects -
Returns:

cloneContainer

public static final java.util.List cloneContainer(java.util.List objects)
Used by Image subclasses to clone container instances.

Parameters:
objects -
Returns:

cloneContainer

public static final java.util.Map cloneContainer(Image parent,
                                                 java.util.Map objects)
Used by Image subclasses to clone container instances.

Parameters:
parent -
objects -
Returns:

cloneContainer

public static final java.util.List cloneContainer(Image parent,
                                                  java.util.List objects)
Used by Image subclasses to clone container instances.

Parameters:
parent -
objects -
Returns:

isDependentImage

public static final boolean isDependentImage(java.lang.String imageType)

isDependentImage

public static final boolean isDependentImage(java.lang.Class imageType)

getImageableTypeFrom

public static final java.lang.String getImageableTypeFrom(java.lang.String imageType)

getImageableTypeFrom

public static final java.lang.String getImageableTypeFrom(java.lang.Class imageType)

getImageInterfaceTypeFrom

public static final java.lang.String getImageInterfaceTypeFrom(java.lang.String imageType)

getImageInterfaceTypeFrom

public static final java.lang.String getImageInterfaceTypeFrom(java.lang.Class imageType)

getEdgesFrom

public static final java.lang.String[] getEdgesFrom(java.lang.String imageType)

getEdgesFrom

public static final java.lang.String[] getEdgesFrom(java.lang.Class imageType)

getLiteralsFrom

public static final java.lang.String[] getLiteralsFrom(java.lang.String imageType)

getLiteralsFrom

public static final java.lang.String[] getLiteralsFrom(java.lang.Class imageType)

getLiteralTypesFrom

public static final java.lang.String[] getLiteralTypesFrom(java.lang.String imageType)

getLiteralTypesFrom

public static final java.lang.String[] getLiteralTypesFrom(java.lang.Class imageType)

getReadOnlyLiteralsFrom

public static final boolean[] getReadOnlyLiteralsFrom(java.lang.String imageType)

getReadOnlyLiteralsFrom

public static final boolean[] getReadOnlyLiteralsFrom(java.lang.Class imageType)

getEdgeTypesFrom

public static final java.lang.String[] getEdgeTypesFrom(java.lang.String imageType)

getEdgeTypesFrom

public static final java.lang.String[] getEdgeTypesFrom(java.lang.Class imageType)

getEdgeImageTypesFrom

public static final java.lang.String[] getEdgeImageTypesFrom(java.lang.String imageType)

getEdgeImageTypesFrom

public static final java.lang.String[] getEdgeImageTypesFrom(java.lang.Class imageType)

getReadOnlyEdgesFrom

public static final boolean[] getReadOnlyEdgesFrom(java.lang.String imageType)

getReadOnlyEdgesFrom

public static final boolean[] getReadOnlyEdgesFrom(java.lang.Class imageType)

getDependentEdgesFrom

public static final boolean[] getDependentEdgesFrom(java.lang.String imageType)

getDependentEdgesFrom

public static final boolean[] getDependentEdgesFrom(java.lang.Class imageType)

getReferenceOnlyEdgesFrom

public static final boolean[] getReferenceOnlyEdgesFrom(java.lang.String imageType)

getReferenceOnlyEdgesFrom

public static final boolean[] getReferenceOnlyEdgesFrom(java.lang.Class imageType)

findIndexOf

public static final int findIndexOf(Image image,
                                    java.lang.String edgeName)

copyImage

public static final Image copyImage(Image originalImage,
                                    boolean keepImageableIdentity)
Returns a clone of the given Image instance.
The given Image instance is given a new identity unless keepIdenity is true.

Parameters:
originalImage -
keepImageableIdentity - false if resulting Image instance should have a new identity
Returns:

copyImage

public static final Image copyImage(Image originalImage,
                                    boolean keepImageableIdentity,
                                    boolean keepImageIdentity)
Returns a clone of the given Image instance.
Image instances have Imageable identity if they are reflected (via a 'select') from a remote Imageable instance. They have a transient local image identity if the instance was instantiated locally.

Parameters:
originalImage -
keepImageableIdentity - false if resulting Image instance should lose its Imageable identity
keepImageIdentity - false if resulting Image instance should have lose its local identity
Returns:


Copyright (C) 2002 Vinculum Technologies, Inc. All Rights Reserved.