Example #1
0
 public Builder<BUILDER, C> path(final ContentPath path) {
   this.parentPath = path.getParentPath() != null ? path.getParentPath().asAbsolute() : null;
   Preconditions.checkArgument(
       path.elementCount() > 0, "No content can be \"root content\": " + path.toString());
   this.name = ContentName.from(path.getElement(path.elementCount() - 1));
   return this;
 }
 @Override
 public int hashCode() {
   final int PRIME = 31;
   int result = 1;
   result = PRIME * result + ((_publisher == null) ? 0 : _publisher.hashCode());
   result = PRIME * result + ((_name == null) ? 0 : _name.hashCode());
   return result;
 }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   final KeyName other = (KeyName) obj;
   if (_publisher == null) {
     if (other._publisher != null) return false;
   } else if (!_publisher.equals(other._publisher)) return false;
   if (_name == null) {
     if (other._name != null) return false;
   } else if (!_name.equals(other._name)) return false;
   return true;
 }
  /**
   * Thought about encoding and decoding as flat -- no wrapping declaration. But then couldn't use
   * these solo.
   */
  @Override
  public void decode(XMLDecoder decoder) throws ContentDecodingException {
    decoder.readStartElement(getElementLabel());

    _name = new ContentName();
    _name.decode(decoder);

    if (PublisherID.peek(decoder)) {
      _publisher = new PublisherID();
      _publisher.decode(decoder);
    }

    decoder.readEndElement();
  }
Example #5
0
 public Builder name(final String name) {
   this.name = ContentName.from(name);
   return this;
 }