Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.attributes

pack-priv final Class UnsafeAttributeHolder

extends Object
implements AttributeHolder
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.attributes.AttributeHolder
Imports
java.util.HashMap, .HashSet, .Map, .Set, java.util.function.Supplier

A non thread-safe AttributeHolder implementation.
Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
protected class
private static class

Field Summary

Modifier and TypeField and Description
pack-priv final DefaultAttributeBuilder
private final UnsafeAttributeHolder.Holder
private final UnsafeAttributeHolder.Holder
private final UnsafeAttributeHolder.Holder
private final UnsafeAttributeHolder.Holder
pack-priv final UnsafeAttributeHolder.IndexedAttributeAccessorImpl
private boolean
private Map<Integer, Object>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements org.glassfish.grizzly.attributes.AttributeHolder.clear.

Clear all the attributes.

public void
copyFrom(final AttributeHolder srcAttributes)

Implements org.glassfish.grizzly.attributes.AttributeHolder.copyFrom.

Copies attributes from the srcAttributes to this AttributeHolder

public void
copyTo(final AttributeHolder dstAttributes)

Implements org.glassfish.grizzly.attributes.AttributeHolder.copyTo.

Copies attributes from this AttributeHolder to the dstAttributes.

public Object
getAttribute(final String name)

Implements org.glassfish.grizzly.attributes.AttributeHolder.getAttribute.

Return an object based on a name.

public Object
getAttribute(final String name, final Supplier<T> initializer)

Implements org.glassfish.grizzly.attributes.AttributeHolder.getAttribute.

Return an object based on a name.

public AttributeBuilder
getAttributeBuilder()

Implements org.glassfish.grizzly.attributes.AttributeHolder.getAttributeBuilder.

Get AttributeBuilder, associated with this holder

public Set<String>
public IndexedAttributeAccessor
getIndexedAttributeAccessor()

Implements org.glassfish.grizzly.attributes.AttributeHolder.getIndexedAttributeAccessor.

If AttributeHolder supports attribute access by index - it will return an IndexedAttributeAccessor, which will make Attribute access as fast as access to array element.

public void
public Object
public void
setAttribute(final String name, final Object value)

Implements org.glassfish.grizzly.attributes.AttributeHolder.setAttribute.

Set a name/value object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeBuilderback to summary
pack-priv final DefaultAttributeBuilder attributeBuilder
h1back to summary
private final UnsafeAttributeHolder.Holder h1
h2back to summary
private final UnsafeAttributeHolder.Holder h2
h3back to summary
private final UnsafeAttributeHolder.Holder h3
h4back to summary
private final UnsafeAttributeHolder.Holder h4
indexedAttributeAccessorback to summary
pack-priv final UnsafeAttributeHolder.IndexedAttributeAccessorImpl indexedAttributeAccessor
isSetback to summary
private boolean isSet
valueMapback to summary
private Map<Integer, Object> valueMap

Constructor Detail

UnsafeAttributeHolderback to summary
pack-priv UnsafeAttributeHolder(final DefaultAttributeBuilder attributeBuilder)

Method Detail

clearback to summary
public void clear()

Implements org.glassfish.grizzly.attributes.AttributeHolder.clear.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.clear.

Clear all the attributes.

Annotations
@Override
copyFromback to summary
public void copyFrom(final AttributeHolder srcAttributes)

Implements org.glassfish.grizzly.attributes.AttributeHolder.copyFrom.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.copyFrom.

Copies attributes from the srcAttributes to this AttributeHolder

Annotations
@Override
copyToback to summary
public void copyTo(final AttributeHolder dstAttributes)

Implements org.glassfish.grizzly.attributes.AttributeHolder.copyTo.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.copyTo.

Copies attributes from this AttributeHolder to the dstAttributes.

Annotations
@Override
getAttributeback to summary
public Object getAttribute(final String name)

Implements org.glassfish.grizzly.attributes.AttributeHolder.getAttribute.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.getAttribute.

Return an object based on a name.

Annotations
@Override
getAttributeback to summary
public Object getAttribute(final String name, final Supplier<T> initializer)

Implements org.glassfish.grizzly.attributes.AttributeHolder.getAttribute.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.getAttribute.

Return an object based on a name.

Annotations
@Override
getAttributeBuilderback to summary
public AttributeBuilder getAttributeBuilder()

Implements org.glassfish.grizzly.attributes.AttributeHolder.getAttributeBuilder.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.getAttributeBuilder.

Get AttributeBuilder, associated with this holder

Annotations
@Override
getAttributeNamesback to summary
public Set<String> getAttributeNames()

Implements org.glassfish.grizzly.attributes.AttributeHolder.getAttributeNames.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.getAttributeNames.

Return a Set of attribute names.

Annotations
@Override
getIndexedAttributeAccessorback to summary
public IndexedAttributeAccessor getIndexedAttributeAccessor()

Implements org.glassfish.grizzly.attributes.AttributeHolder.getIndexedAttributeAccessor.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.getIndexedAttributeAccessor.

If AttributeHolder supports attribute access by index - it will return an IndexedAttributeAccessor, which will make Attribute access as fast as access to array element.

Annotations
@Override
recycleback to summary
public void recycle()

Implements org.glassfish.grizzly.attributes.AttributeHolder.recycle.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.recycle.

Recycle AttributeHolder

Annotations
@Override
removeAttributeback to summary
public Object removeAttribute(final String name)

Implements org.glassfish.grizzly.attributes.AttributeHolder.removeAttribute.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.removeAttribute.

Remove a name/value object.

Annotations
@Override
setAttributeback to summary
public void setAttribute(final String name, final Object value)

Implements org.glassfish.grizzly.attributes.AttributeHolder.setAttribute.

Doc from org.glassfish.grizzly.attributes.AttributeHolder.setAttribute.

Set a name/value object.

Annotations
@Override
org.glassfish.grizzly.attributes back to summary

private final Class UnsafeAttributeHolder.Holder

extends Object
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.attributes.UnsafeAttributeHolder.Holder

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv boolean
pack-priv Object

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv void
private void
private boolean
is(final int idx)

pack-priv Object
set(final int idx, final Object value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

idxback to summary
pack-priv int idx
isSetback to summary
pack-priv boolean isSet
valueback to summary
pack-priv Object value

Constructor Detail

Holderback to summary
private Holder()

Method Detail

clearback to summary
pack-priv void clear()
copyFromback to summary
private void copyFrom(final UnsafeAttributeHolder.Holder src)
isback to summary
private boolean is(final int idx)
setback to summary
pack-priv Object set(final int idx, final Object value)
org.glassfish.grizzly.attributes back to summary

protected final Class UnsafeAttributeHolder.IndexedAttributeAccessorImpl

extends Object
implements IndexedAttributeAccessor
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.attributes.UnsafeAttributeHolder.IndexedAttributeAccessorImpl
All Implemented Interfaces
org.glassfish.grizzly.attributes.IndexedAttributeAccessor

IndexedAttributeAccessor implementation.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private UnsafeAttributeHolder.Holder
public Object
getAttribute(final int index)

Implements org.glassfish.grizzly.attributes.IndexedAttributeAccessor.getAttribute.

Internal method for dynamic attribute support.

public Object
getAttribute(final int index, final Supplier<T> initializer)

Implements org.glassfish.grizzly.attributes.IndexedAttributeAccessor.getAttribute.

Internal method for dynamic attribute support.

private Object
getAttribute(final Attribute<T> attribute, final Supplier<T> initializer)

private UnsafeAttributeHolder.Holder
holderByIdx(final int idx)

private UnsafeAttributeHolder.Holder
public Object
removeAttribute(final int index)

Implements org.glassfish.grizzly.attributes.IndexedAttributeAccessor.removeAttribute.

Internal method for dynamic attribute support.

private Object
removeAttribute(final Attribute<T> attribute)

public void
setAttribute(final int index, final Object value)

Implements org.glassfish.grizzly.attributes.IndexedAttributeAccessor.setAttribute.

Internal method for dynamic attribute support.

private Object
setAttribute(final Attribute<T> attribute, final Object value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

IndexedAttributeAccessorImplback to summary
protected IndexedAttributeAccessorImpl()

Method Detail

emptyHolderback to summary
private UnsafeAttributeHolder.Holder emptyHolder()
getAttributeback to summary
public Object getAttribute(final int index)

Implements org.glassfish.grizzly.attributes.IndexedAttributeAccessor.getAttribute.

Doc from org.glassfish.grizzly.attributes.IndexedAttributeAccessor.getAttribute.

Internal method for dynamic attribute support. Return the value of the attribute by index.

Annotations
@Override
getAttributeback to summary
public Object getAttribute(final int index, final Supplier<T> initializer)

Implements org.glassfish.grizzly.attributes.IndexedAttributeAccessor.getAttribute.

Doc from org.glassfish.grizzly.attributes.IndexedAttributeAccessor.getAttribute.

Internal method for dynamic attribute support. Return the value of the attribute by index. If the attribute with such index is not set, set it to the default value, using the initializer, and return the default.

Annotations
@Override
getAttributeback to summary
private Object getAttribute(final Attribute<T> attribute, final Supplier<T> initializer)
holderByIdxback to summary
private UnsafeAttributeHolder.Holder holderByIdx(final int idx)
nullHolderback to summary
private UnsafeAttributeHolder.Holder nullHolder()
removeAttributeback to summary
public Object removeAttribute(final int index)

Implements org.glassfish.grizzly.attributes.IndexedAttributeAccessor.removeAttribute.

Doc from org.glassfish.grizzly.attributes.IndexedAttributeAccessor.removeAttribute.

Internal method for dynamic attribute support. Removes the attribute with the index and returns its previous value.

Annotations
@Override
removeAttributeback to summary
private Object removeAttribute(final Attribute<T> attribute)
setAttributeback to summary
public void setAttribute(final int index, final Object value)

Implements org.glassfish.grizzly.attributes.IndexedAttributeAccessor.setAttribute.

Doc from org.glassfish.grizzly.attributes.IndexedAttributeAccessor.setAttribute.

Internal method for dynamic attribute support. Set the attribute with the index to value.

Annotations
@Override
setAttributeback to summary
private Object setAttribute(final Attribute<T> attribute, final Object value)
org.glassfish.grizzly.attributes back to summary

private final Class UnsafeAttributeHolder.MapperAccessor

extends Object
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.attributes.UnsafeAttributeHolder.MapperAccessor

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
private static Object
getValue(final UnsafeAttributeHolder holder, final Integer idx)

private static Object
setValue(final UnsafeAttributeHolder holder, final Integer idx, final Object value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MapperAccessorback to summary
private MapperAccessor()

Method Detail

copyback to summary
private static void copy(final UnsafeAttributeHolder src, final UnsafeAttributeHolder dst)
getValueback to summary
private static Object getValue(final UnsafeAttributeHolder holder, final Integer idx)
setValueback to summary
private static Object setValue(final UnsafeAttributeHolder holder, final Integer idx, final Object value)