Factory method usage, creating the correct Image subclass

Hi, I created a factory method
  public enum ImgType {
    SINGLE, STRIP, SPRITE_SHEET
public static Image createImage(ImgType imgType) {
    switch (imgType) {
      case SINGLE:
        return new MyImage1(0, 0);
      case SPRITE_SHEET:
        return new MyImage2("", 0, 0);
      case STRIP:
        return new MyImage3("", 0, 0);
      default:
        throw new IllegalArgumentException("The image type " + imgType + " is not recognized.");
  }that creates different images based on the enum type provided.
and heres is a usage of that function
  public BufferedImage loadAwtImage(ImageInputStream in, String imgName,  ImageTypeFactory.ImgType imgType) throws IOException {
    BufferedImage img = imgLoader.loadImage(in);
    BufferedImage imgsubType = ImageTypeFactory.createImage(imgType);  // Convert to real Image type
    addAwtImg(imgName, imgsubType);
    return imgsubType;
  }In a test:
imgLib.loadAwtImage(imageStream, "cursor", ImageTypeFactory.ImgType.SPRITE_SHEET);Is it 'good' that in the test I can say(using the imgType enum) what sort of Image should be returned?
doesn't this expose the working of the class to the outside, on the other hand I don't know howto create the correct sub image based on an image loaded.
I use subImages to allow selection within the image, like the 3th 'tile' within an imageStrip returns just that cropped image.
Before I had List<Image> and List<List<Image>> and now I can just return Images in 1 method instead of 2,3 by using lists.
Edited by: stef569 on Dec 12, 2008 11:05 AM

creates specifications... :p
*  load the BufferedImage from the ImageInputStream
* add it to the cache keyed by the imgName
* @return a BufferedImage, or a custom subclass based on the imgType
* @throws IOException when the img could not be loaded
public BufferedImage loadAwtImage(ImageInputStream in, String imgName,  ImageTypeFactory.ImgType imgType) throws IOException I can test it, but the ImageTypeFactory.ImgType imgType parameter looks wrong to me.
if you see this in a class method would you change it/find a better way.

Similar Messages

  • Hi all! What is the best way to create the correct space for baseball jersey names and numbers? along with making sure they are the right size for large printing.

    What is the best way to create the correct space for baseball jersey names and numbers? along with making sure they are the right size for large printing.

    Buying more hard drive space is a very valid option, here.  Editing takes up lots of room, you should never discount the idea of adding more when you need it.
    Another possibility is exporting to MXF OP1a using the AVC-I codec.  It's not lossless, but it is Master quality.  Plus the file size is a LOT smaller, so it may suit your needs.

  • Can't create the file "images/Dawings_By_Student_files/rss.xml." The disk may be damaged or full, or you may not have sufficient access privileges.

    I added two drawings to the web site I was working on in iweb..then tried to publish the changes and it gives me this "Can’t create the file “images/Dawings_By_Student_files/rss.xml.” The disk may be damaged or full, or you may not have sufficient access privileges."  Help I have no idea what to do.

    Try the troubleshooting steps under "Fix iWeb" here...
    http://www.iwebformusicians.com/iWeb/iWeb-Tips.html

  • HT1198 I shared disk space and my iPhoto library as described in this article. When creating the disk image, I thought I had set aside enough space to allow for growth (50G). I'm running out of space. What's the best way to increase the disk image size?

    I shared disk space and my iPhoto library as described in this article. When creating the disk image, I thought I had set aside enough space to allow for growth (50G). I'm running out of space. What's the best way to increase the disk image size?

    Done. Thank you, Allan.
    The sparse image article you sent a link to needs a little updating (or there's some variability in prompts (no password was required) with my OS and/or Disk Utility version), but it worked.
    Phew! It would have been much more time consuming to use Time Machine to recover all my photos after repartitioning the drive. 

  • How to get a method to call the correct passed object in the constructor

    I have 2 constructors for a certain object:
    public class ABC{
    //variables
    private DEF def;
    private GHI ghi;
    public ABC(DEF def){
    this.def = def;
    someMethod();
    public ABC(GHI ghi){
    this.ghi = ghi;
    someMethod();
    }Now, this someMethod() references / calls a method from the 2 classes passed in the constructor say def.getSome() and ghi.getSome().
    Depending on which constructor is used, it should call the respective xxx.getSome(). Do I need to write 2 someMethod()s or is there a way that one method will call the proper xxx.getSome() ?
    Thanks.....

    Hi
    Following the example may be help to you call correct method,
    // Interface QuizMaster
    public interface QuizMaster {
         public String popQuestion();
    // Class StrutsQuizMaster
    public class StrutsQuizMaster implements QuizMaster{
         public String popQuestion() {
              return "Are you new to Struts?";
    // Class SpringQuizMaster
    public class SpringQuizMaster implements QuizMaster{
         public String popQuestion() {
              return "Are you new to Spring?";
    // Class QuizMasterService
    public class QuizMasterService {
         QuizMaster quizMaster;
         public QuizMasterService(SpringQuizMaster quizMaster){
              this.quizMaster = quizMaster;
         public QuizMasterService(StrutsQuizMaster quizMaster){
              this.quizMaster = quizMaster;
         public void askQuestion()
              System.out.println(quizMaster.popQuestion());
    // QuizProgram
    public class QuizProgram {
         public static void main(String[] args) {
              // Option : 1
    // StrutsQuizMaster quizMaster = new StrutsQuizMaster();
    // Option : 2
    SpringQuizMaster quizMaster = new SpringQuizMaster();
              QuizMasterService quizMasterService = new QuizMasterService(quizMaster);                    
              quizMasterService.askQuestion();
    here you can create object of StrutsQuizMaster or SpringQuizMaster and pass into the QuizMasterService object constructor, base on the object correct method will be called.

  • How to call a instance method without creating the instance of a class

    class ...EXCH_PRD_VERT_NN_MODEL definition
    public section.
      methods CONSTRUCTOR
        importing
          value(I_ALV_RECORDS) type ..../EXCH_VBEL_TT_ALV
          value(I_HEADER) type EDIDC .
      methods QUERY
        importing
          I_IDEX type FLAG
          i_..........
        returning
          value(R_RESULTS) type .../EXCH_VBEL_TT_ALV .
    Both methods are instance methods.
    But in my program i cannot created instance of the class unless i get the results from Query.
    I proposed that Query must be static, and once we get results we can create object of the class by pasing the result table which we get from method query.
    But i must not change the method Query to a static method.
    Is there any way out other than making method Query as static ?
    Regards.

    You can't execute any instance method without creating instance of the class.
    In your scenario, if you don't want to process your method of your class, you can check the instance has been created or not.
    Like:
    IF IT_QUERY IS NOT INITIAL.
      CRATE OBJECT O_QUERY EXPORTING......
    ENDIF.
    IF O_QUERY IS NOT INITIAL.
    CALL METHOD O_QUERY->QUERY EXPORTING....
    ENDIF.
    Regards,
    Naimesh Patel

  • How to locate the correct image file before reading/saving it

    Hi,
    I would like to find out how to copy/save/read image files from certain website in Java, particularly to locate the right one from various relative URL links on the same website. Below is an example to look at:
    On the main web page
    By selecting (http://www.abc.com/Public/Details.aspx?adid=2007103609) on a tiny camera icon that consist of source code (<td class="even"><a target="_blank" href="http://www.abc.com/Public/Details.aspx?adid=2007135110"><img src="/images/camera.gif" width="19" ...></a></td>) directed me to another page with the actual photo.
    The source code of this secondary page where the photo is located are as follows:
    <script language="JavaScript" type="text/javascript"><!--
    </script>
    <style type="text/css">@import url("http://fdimages.def.com.au/cui/netstrip-20050427.css");</style>
    <div id="networkStripTop">
    <a href="http://www.def.com.au/" onclick="linktop(this);" target="_top"><img src="http://fdimages.def.com.au/cui/digital.gif" height="17" width="95" class="logo" alt="DEF Digital" /></a>
    <div class="links">Any suggestion would be much appreciated.
    Many thanks,
    Jack

    Hi All,
    Could someone give me a hand with suggesting on how to locate the correct links (from multiple web pages) of the image file? I still could not proceed further on this issue.
    There is no problem with saving/reading the file once it is accurately identified.
    Please move it to the Java Technology & XML forum if it is not already in it.
    Many thanks,
    Jack

  • Creating the mirror image...

    I used to have a workflow for taking any image, and making the top half appear as if it's a mirror image in a lake on the bottom.
    I started (if memory serves correct), by finding the point where the water hits the original and I would create a layer and fill it with blue.
    I then copied, rotated the top onto it's own layer so it was a mirror view.
    I then gaussean blurred (if I remember correctly) and did something to have this effect very realistic and I just can't find my notes on this.
    Does anyone have a suggested workflow or tutorial?
    Thanks

    Maybe Motion Blur with transparency locked? Perhaps something in this tutorial will jog your memory.
    http://photoshopcontest.com/tutorials/26/displacement-water.html
    Unless you also have Photoshop, skip down to the second section of this tutorial.
    Don't let not being able to do the channel bit deter you. You can take an image of water...or a water texture you've made...and save it in PSD format to use to displace the water surface. It's also helpful to blur the texture a bit before using it with the displacement filter.
    Terri

  • Keyword List doesn't show the correct images when clicked

    I'm using LR 2.3RC on a Windows Vista Ultimate PC, although the same error occurs on LR2.2.
    I have a keyword structure "Karl > Family > People" with Karl having 33 images with this keyword. When I use the "Keyword List" on the right panel in the Library module to display these images I get over fourteen thousand images in the grid! This doesn't happen when I use the "Library Filter" bar above the grid.
    What gives?

    Don,
    the result of clicking on "Karl" should display 33 images in total. In fact I'm getting 14,589 of a possible total of 14,734 in the catalogue. This hardly a limitation, rather the opposite I would say!
    John

  • Is there a REAL method to create the initial data replica TO A USB DRIVE for DPM 2012?

    I've got several remote office locations with file servers containing a good amount of data, but they have very poor (3Mbps) WAN connections.
    I've been tasked to set up DPM to back up these locations.  Due to the size of the data and the lack of bandwidth, I'm going to need to get the techs out there
    to copy the data portions of the servers onto USB drives and send them to me so I can import them into the DPM storage here.
    But I’m having some problems finding the document that instructs a tech
    how to copy the initial data replica to a USB drive, then docs on how I can import this data.
    I have found this: 
    http://technet.microsoft.com/en-us/library/jj642916.aspxbut
    it talks about server-to-server copying, which previously mentioned is not something we can
    not do due to bandwidth issues.  We need to copy to USB drive, then ship the drive to me for import into DPM.
    There’s some mention of doing this to tape (then importing to DPM) as well, but I can’t find more details either… it’s sort of weird, like the documentation or help
    files on TechNet are incomplete.  Like take a look at this link http://technet.microsoft.com/en-us/library/hh757818.aspx-- it’s
    pretty useless!
    Has anyone done this yet?  Can anyone please point me in the right direction?

    YES - we do this all the time.  In fact we never do the initial replica creation over the WAN.
    Let's say you want to protect the entire D: drive of your server.  Attach the USB drive to the server and use robocopy to copy everything to the USB drive.  Something like (assuming the USB drive is E:) --
    robocopy D:\ E:\ /b /e /r:0
    You don't have to worry about copying permissions and all that stuff to the USB drive. DPM will take care of that during the initial consistency check and will make sure the DPM replica is an exact copy.  (If you DO want to make sure the USB copy has
    the same permissions, add the /copyall switch to the robocopy command.)
    On the DPM server, set up protection for that server's D: drive and make sure you choose the option to do the initial replica creation MANUALLY.  Once protection has been set up, you basically use robocopy again to transfer data from the USB drive to
    the replica path on the DPM server.
    You can find the replica path on the DPM server by going to the "Protection" area of the console and selecting the protected member of your file server (like the D: drive in the above example).  In the bottom pane there will be a "Replica Path" line
    with a hyperlink that says "Click to view details".  Click that and a dialog will open. You can copy the path to the clipboard.  The path will be something like this:
    C:\Program Files\Microsoft DPM\DPM\Volumes\Replica\File System\vol_7a200c36-19b0-4f92-b05b-16458180f0fa\f1295bef-8329-46a4-9761-85e82017603d\Full
    Just use a similar robocopy command to copy everything to the replica path.  Make sure you put quotes around the replica path destination since there are spaces in it.  Once robocopy is complete, you initiate a consistency check in the DPM console.
    That's all there is to it...

  • Factory methods and downcasting

    I am having a class hierarchy and a factory method that creates the classes from this hierarchy. The factory method returns the root class of this hierarchy and every time I want to use a class specific method of one of the sub classes I will have to check the type of this class and cast to this class type. My question is now if there is a possibility to avoid the type checking and casting or if this is one of the few situations where type checking and casting is approriate. To illustrate the problem here is some code:
    class Factory {
      public static A create() {
        if (//someCondition)
           return new B();
        else
          return new C();
    abstract class A {
      public void commonMethod() {
        // do stuff
      public void polymorphicMethod();
    class B extends A {
      public void polymorphicMethod() {
        // do something
      public void specificBMethod() {
        // do stuff that only B can do
    class C extends A {
      public void polymorphicMethod() {
        // do some other thing
      public void specificCMethod() {
        // do stuff that only C can do
    }Now I run into a situation where I have to downcast to the correct type.
    class Worker {
      public void work() {
        A a = Factory.create();
        if (a instanceof B) {
          ( (B) a).specificBMethod();
        } else if (a instanceof C) {
          ( (C) a).specificCMethod();
        } else {
          // Error
    }I think this problem always arises if you have a factory method that returns a class at the top of the hierarchy or a interface but you can not put all the methods that a client wants to call in this common class or interface. Is there a better a way to do this or is this already a good solution?

    In my particular case I have an XML parser that
    parses messages. I implemented each different message
    type as a different class and the parser uses the
    factory to create new message objects. The parser
    then uses methods that are defined in the topmost
    Message class and in an interface to set the
    attributes of the object. Each message class
    overrides a "handleXMLElement" method defining how to
    deal with the message specific XML elements. So this
    is fine the parser is the client of the factory and
    he uses only methods that are defined in a common
    class and an interface.
    After a message has been read the message object is
    forwarded to a hierarchy of message handlers. Of
    course the message handlers know of the message class
    hierarchy and want to access all methods of each
    message object. But since the parser only knows about
    the interface and the common class, the message
    handlers will have to cast the message objects to the
    concrete types.If the message type that's passed in has its behavior in the common interface, why is there a need to cast?
    So the parser-factory relationship works well but the
    (nasty) casting arises due to the later message
    handling. Maybe your message handling needs redesign. Or perhaps a hierarchy of callback objects that let you customize that part that changes for each message.
    I also remembered why I implemented it this
    way. In the Desing Patterns book of Gamma et. al.
    the Chain of Responsibility pattern can be
    implemented this way using casts. So the solution
    can't be that bad at all, I guess.Don't take that as gospel. GoF isn't perfection. Patterns can be misapplied.
    @stefan: I can't pull all my methods from the
    subclasses in one upper class, because the methods
    are different and specialised for each sub class. I
    don't think that it is good when one sub class knows
    all the methods of all other sub classes.Maybe a callback object can help sort this out. I think you need a redesign to eliminate the casts. More thinking is required.
    %

  • How can I create a one image per page caption sheet that includes the description in Bridge?

    I am trying to find a way to create a one-image-per-page caption sheet for my workflow. I currently place each image into Word and copy the description onto the document, then repeat for each image. I am hoping that there is a way to automate this process using Bridge. I know that it can be done using Lightroom, however, that is not currently an option for me. Is this something that can be done or am I bound, like Sisyphus to Microsoft Word? I have a very limited grasp of scripting, but I feel like this is possible.
    Thanks for any help.

    To create a NetBoot image, you could just put the cluster node in target mode and attach it to your PowerBook. Then use SIU to create the NetBoot image.
    If you're trying to create a backup image of the disk, use hdiutil, or put in in target mode and create the image with Disk Utility.

  • Trying to understand Objective C warning related to factory method

    All,
    I'm just beginning learning objective C (I am a C++ programmer by day), and I have a question about a warning I am seeing in my code. I found some really simple example code on the web that used the 'new' factory method to create an instance of an object. Here are the three files:
    List.h
    #import <objc/Object.h>
    @interface List : Object // List is a subclass of the superclass Object
    int list[100]; // These are instance variables.
    int size;
    /* Public methods */
    - free;
    - (int) addEntry: (int) num;
    - print;
    /* Private methods */
    /* Other programs should not use these methods. */
    - resetSize;
    @end
    List.m
    #import "List.h"
    @implementation List
    + new // factory method
    self = [super new];
    printf("inside new\n");
    [self resetSize];
    return self;
    - free
    return [super free];
    - (int) addEntry: (int) num
    list[size++] = num;
    return size;
    - print
    int i;
    printf("\n");
    for (i = 0; i < size; ++i)
    printf ("%i ", list);
    return self; // Always return self
    // if nothing else makes sense.
    - resetSize
    printf("Inside resetSize\n");
    size = 0;
    return self;
    @end
    main.m
    #import <objc/Object.h>
    #import "List.h" // Note the new commenting style.
    main()
    id list; // id is a new data type for objects.
    list = [List new]; // create an instance of class List.
    [list resetSize];
    [list addEntry: 5]; // send a message to the object list
    [list print];
    [list addEntry: 6];
    [list addEntry: 3];
    [list print];
    printf("\n");
    [list free]; // get rid of object
    Now, I know that the 'best' way to allocate and initialize an object is through [[List alloc] init], but I'm seeing a strange warning when I compile List.m, and I just want to understand why it's showing up. Here's the warning.
    List.m: In function ‘+[List new]’:
    List.m:9: warning: ‘List’ may not respond to ‘+resetSize’
    List.m:9: warning: (Messages without a matching method signature
    List.m:9: warning: will be assumed to return ‘id’ and accept
    List.m:9: warning: ‘...’ as arguments.)
    It looks like something is assuming that resetSize is a factory method rather than an instance method. The strange thing, though, is that the program works exactly like expected. resetSize is actually called from within the new method correctly.
    Any ideas why I'm seeing the error, and how I should get rid of it?
    Thanks,
    Eric

    Thanks for clearing that up for me - it makes sense now. And sorry about the formatting problems - I guess forgetting the {code} tags make a pretty big difference
    It's taking a little bit for my mind to switch from C++ syntax to Objective C, but I'm able to visualize the problem and the reason the code I found produced the error.
    Thanks again,
    Eric

  • I want a preview for only the pick image

    I sync my photos with an iPod. As such I only want to sync the images that are picks. I edit virtually every single image in my library, so as it is if I have automatic generation of previews turned on, all the images including non-pick ones in each stack will have a preview. This causes 2 or more versions of the same image to be put onto the iPod not just the best one.
    For the past few months I have had automatic generation of previews turned off, and I generate them by hand after I finish editing a batch. This is a little time consuming and I often either forget to generate the previews or somehow I manage to generate previews for all images in a stack. Aperture doesn't help because it doesn't show which images have previews and which don't.
    Rather than manually going through each stack and seeing which images have previews, I'd like to automate the process somewhat to make sure that only the picks have previews. Is there an easy way to do this?
    I've thought about selecting all, then opening all stacks, then inverting the selection, and deleting previews from those selections. Then inverting the selection again and updating the previews. I'm not sure if this would work and I'm a bit scared to do this on a large library (opening all stacks in a selection of 10000 stacks could take a few days?)
    I wish Aperture had better handling of previews in this regard.

    Problem with creating a smart album is that all images would show up in that one album on the iPod and I want them somewhat separated, even though no hierarchy of folders on the ipod makes that a bit of a paint too.
    I am currently trying the select/invert method. I'm doing it one album at a time so it's more manageable. At the same time I'm able to make sure I have the correct image as my pick, and also forces me to reexamine what photos I have in my albums and delete any stuff that isn't worthy It's working pretty well, though it is time consuming. Once I'm done I'll have to be careful to make sure only the picks get a preview.

  • The method clone() from the type Object is not visible

    Hi,
    This is my 1st post here for a few years, i have just returned to java.
    I am working through a java gaming book, and the "The method clone() from the type Object is not visible" appears, preventing the program from running. I understand "clone" as making a new copy of an object, allowing multiple different copies to be made.
    The error occurs here
    public Object clone() {
            // use reflection to create the correct subclass
            Constructor constructor = getClass().getConstructors()[0];
            try {
                return constructor.newInstance(new Object[] {
                    (Animation)left.clone(),
                    (Animation)right.clone(),
                    (Animation)deadLeft.clone(),
                    (Animation)deadRight.clone()
            catch (Exception ex) {
                // should never happen
                ex.printStackTrace();
                return null;
        }The whole code for this class is here
    package tilegame.sprites;
    import java.lang.reflect.Constructor;
    import graphics.*;
        A Creature is a Sprite that is affected by gravity and can
        die. It has four Animations: moving left, moving right,
        dying on the left, and dying on the right.
    public abstract class Creature extends Sprite {
            Amount of time to go from STATE_DYING to STATE_DEAD.
        private static final int DIE_TIME = 1000;
        public static final int STATE_NORMAL = 0;
        public static final int STATE_DYING = 1;
        public static final int STATE_DEAD = 2;
        private Animation left;
        private Animation right;
        private Animation deadLeft;
        private Animation deadRight;
        private int state;
        private long stateTime;
            Creates a new Creature with the specified Animations.
        public Creature(Animation left, Animation right,
            Animation deadLeft, Animation deadRight)
            super(right);
            this.left = left;
            this.right = right;
            this.deadLeft = deadLeft;
            this.deadRight = deadRight;
            state = STATE_NORMAL;
        public Object clone() {
            // use reflection to create the correct subclass
            Constructor constructor = getClass().getConstructors()[0];
            try {
                return constructor.newInstance(new Object[] {
                    (Animation)left.clone(),
                    (Animation)right.clone(),
                    (Animation)deadLeft.clone(),
                    (Animation)deadRight.clone()
            catch (Exception ex) {
                // should never happen
                ex.printStackTrace();
                return null;
            Gets the maximum speed of this Creature.
        public float getMaxSpeed() {
            return 0;
            Wakes up the creature when the Creature first appears
            on screen. Normally, the creature starts moving left.
        public void wakeUp() {
            if (getState() == STATE_NORMAL && getVelocityX() == 0) {
                setVelocityX(-getMaxSpeed());
            Gets the state of this Creature. The state is either
            STATE_NORMAL, STATE_DYING, or STATE_DEAD.
        public int getState() {
            return state;
            Sets the state of this Creature to STATE_NORMAL,
            STATE_DYING, or STATE_DEAD.
        public void setState(int state) {
            if (this.state != state) {
                this.state = state;
                stateTime = 0;
                if (state == STATE_DYING) {
                    setVelocityX(0);
                    setVelocityY(0);
            Checks if this creature is alive.
        public boolean isAlive() {
            return (state == STATE_NORMAL);
            Checks if this creature is flying.
        public boolean isFlying() {
            return false;
            Called before update() if the creature collided with a
            tile horizontally.
        public void collideHorizontal() {
            setVelocityX(-getVelocityX());
            Called before update() if the creature collided with a
            tile vertically.
        public void collideVertical() {
            setVelocityY(0);
            Updates the animaton for this creature.
        public void update(long elapsedTime) {
            // select the correct Animation
            Animation newAnim = anim;
            if (getVelocityX() < 0) {
                newAnim = left;
            else if (getVelocityX() > 0) {
                newAnim = right;
            if (state == STATE_DYING && newAnim == left) {
                newAnim = deadLeft;
            else if (state == STATE_DYING && newAnim == right) {
                newAnim = deadRight;
            // update the Animation
            if (anim != newAnim) {
                anim = newAnim;
                anim.start();
            else {
                anim.update(elapsedTime);
            // update to "dead" state
            stateTime += elapsedTime;
            if (state == STATE_DYING && stateTime >= DIE_TIME) {
                setState(STATE_DEAD);
    }Any advice? Is it "protected"? Is the code out-of-date?
    thankyou,
    Lance 28

    Lance28 wrote:
    Any advice? Is it "protected"? Is the code out-of-date?Welcome to the wonderful world of Cloneable. In answer to your first question: Object's clone() method is protected.
    A quote from Josh Bloch's "Effective Java" (Item 10):
    "A class that implements Cloneable is expected to provide a properly functioning public clone() method. It is not, in general, possible to do so unless +all+ of the class's superclasses provide a well-behaved clone implementation, whether public or protected."
    One way to check that would be to see if super.clone() works. Their method uses reflection to try and construct a valid Creature, but it relies on Animation's clone() method, which itself may be faulty. Bloch suggests the following pattern:public Object clone() throws CloneNotSupportedException {
       ThisClass copy = (ThisClass) super.clone();
       // do any additional initialization required...
       return copy
    if that doesn't work, you +may+ be out of luck.
    Another thing to note is that Object's clone() method returns a +shallow+ copy of the original object. If it contains any data structures (eg, Collections or arrays) that point to other objects, you may find that your cloned object is now sharing those with the original.
    Good luck.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for