1 22 23 package org.objectweb.petals.tools.jbicommon.descriptor; 24 25 import java.net.URI ; 26 import java.util.HashMap ; 27 import java.util.Map ; 28 29 import org.apache.commons.lang.builder.EqualsBuilder; 30 import org.apache.commons.lang.builder.HashCodeBuilder; 31 import org.apache.commons.lang.builder.ToStringBuilder; 32 import org.w3c.dom.DocumentFragment ; 33 34 39 public class Extensions { 40 41 private DocumentFragment documentFragment; 42 43 private Map <URI , PetalsExtension> petalsExtensions; 44 45 private Map <URI , UnknownExtension> unknownsExtensions; 46 47 public Extensions() { 48 super(); 49 petalsExtensions = new HashMap <URI , PetalsExtension>(); 50 unknownsExtensions = new HashMap <URI , UnknownExtension>(); 51 } 52 53 public void addPetalsExtension(final URI uri, 54 final PetalsExtension extension) { 55 petalsExtensions.put(uri, extension); 56 } 57 58 public void addUnknownExtension(final URI uri, 59 final UnknownExtension extension) { 60 unknownsExtensions.put(uri, extension); 61 } 62 63 @Override 64 public boolean equals(final Object other) { 65 if (!(other instanceof Extensions)) { 66 return false; } 68 Extensions castOther = (Extensions) other; 69 return new EqualsBuilder().append(petalsExtensions, 70 castOther.petalsExtensions).append(unknownsExtensions, 71 castOther.unknownsExtensions).isEquals(); 72 } 73 74 public DocumentFragment getDocumentFragment() { 75 return documentFragment; 76 } 77 78 public Map <URI , PetalsExtension> getPetalsExtensions() { 79 return petalsExtensions; 80 } 81 82 public Map <URI , UnknownExtension> getUnknownsExtensions() { 83 return unknownsExtensions; 84 } 85 86 @Override 87 public int hashCode() { 88 return new HashCodeBuilder().append(petalsExtensions).append( 89 unknownsExtensions).toHashCode(); 90 } 91 92 public void setDocumentFragment(final DocumentFragment documentFragment) { 93 this.documentFragment = documentFragment; 94 } 95 96 public void setPetalsExtensions( 97 final Map <URI , PetalsExtension> petalsExtensions) { 98 this.petalsExtensions = petalsExtensions; 99 } 100 101 public void setUnknownsExtensions( 102 final Map <URI , UnknownExtension> unknownsExtensions) { 103 this.unknownsExtensions = unknownsExtensions; 104 } 105 106 @Override 107 public String toString() { 108 return new ToStringBuilder(this).append("petalsExtensions", 109 petalsExtensions).append("unknownsExtensions", 110 unknownsExtensions).toString(); 111 } 112 113 } 114 | Popular Tags |