Пример #1
0
 /**
  * Add an extension - this changes the data to reflect an extension for this sub type.
  *
  * @param extension
  */
 public void addExtension(SubTypeExtension extension) throws DuplicateNameException {
   if (getExtension(extension.getName()) != null) {
     throw new DuplicateNameException(
         "Subtype extension for subtype " + this + " with name already exists",
         extension.getName());
   }
   extension.setSubType(this);
   extension.setMimeType(
       getTopMediaType().getName() + SubTypeExtension.MIME_TYPE_SEPERATOR + getName());
   extensions.add(extension);
 }
Пример #2
0
 /**
  * Remove an extension from this subtype
  *
  * @param extension to remove
  * @return true if the extension is removed
  */
 private boolean removeExtension(SubTypeExtension extension) {
   extension.setSubType(null);
   return extensions.remove(extension);
 }