Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * JBoss, Home of Professional Open Source.
  * Copyright 2014 Red Hat, Inc., and individual contributors
  * as indicated by the @author tags.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package io.undertow.util;
A thing which can have named attachments.

Author(s):
David M. Lloyd
public interface Attachable {

    
Get an attachment value. If no attachment exists for this key, null is returned.

Parameters:
key the attachment key
<T> the value type
Returns:
the value, or null if there is none
    <T> T getAttachment(AttachmentKey<T> key);

    
Gets a list attachment value. If not attachment exists for this key an empty list is returned

Parameters:
<T> the value type
key the attachment key
Returns:
the value, or an empty list if there is none
    <T> List<T> getAttachmentList(AttachmentKey<? extends List<T>> key);

    
Set an attachment value. If an attachment for this key was already set, return the original value. If the value being set is null, the attachment key is removed.

Parameters:
key the attachment key
value the new value
<T> the value type
Returns:
the old value, or null if there was none
    <T> T putAttachment(AttachmentKey<T> key, T value);

    
Remove an attachment, returning its previous value.

Parameters:
key the attachment key
<T> the value type
Returns:
the old value, or null if there was none
    <T> T removeAttachment(AttachmentKey<T> key);
    
Add a value to a list-typed attachment key. If the key is not mapped, add such a mapping.

Parameters:
key the attachment key
value the value to add
<T> the list value type
    <T> void addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value);
New to GrepCode? Check out our FAQ X