org.argouml.model.uml
Class CopyHelper

java.lang.Object
  extended byorg.argouml.model.uml.CopyHelper

public final class CopyHelper
extends java.lang.Object

Utility class to facilitate copying model elements.

Since:
0.13.2

Field Summary
protected static org.apache.log4j.Logger cat
           
private  java.util.HashMap copyfunctions
           
private static CopyHelper theInstance
           
 
Constructor Summary
private CopyHelper()
           
 
Method Summary
private  void add(java.lang.Class type, java.lang.Class param, java.lang.Object obj, java.lang.String name)
          Adds a copy handler for objects of type type.
 java.lang.Object copy(java.lang.Object anelement, java.lang.Object ans)
          Make a copy of element.
static CopyHelper getHelper()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected static org.apache.log4j.Logger cat

theInstance

private static CopyHelper theInstance

copyfunctions

private java.util.HashMap copyfunctions
Constructor Detail

CopyHelper

private CopyHelper()
Method Detail

getHelper

public static CopyHelper getHelper()

add

private void add(java.lang.Class type,
                 java.lang.Class param,
                 java.lang.Object obj,
                 java.lang.String name)
Adds a copy handler for objects of type type. Since copy functions could be either instance or static functions, if obj is an instance of Class then the function is assumed to be static and will be looked up in obj. Otherwise the function will be looked up in the Class of obj and invoked on obj.

Parameters:
type - is the type to catch.
param - is the parameter type of the copy function.
obj - is described above.
name - is the name of the copy function.

copy

public java.lang.Object copy(java.lang.Object anelement,
                             java.lang.Object ans)
Make a copy of element. This function may fail and return null for any of the following reasons: 1. No copy function is known for element's type. 2. The copy function fails or throws.

Parameters:
anelement - is the element to copy.
Returns:
a copy of element, or null.
Throws:
java.lang.NullPointerException - if element is null.


ArgoUML © 1996-2004 (20040316)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook