com.neeve.lang
Interface XString.Factory<T extends XString>

Type Parameters:
T - The type of the concrete XString or subclass
All Known Implementing Classes:
XString.XStringFactory
Enclosing class:
XString

public static interface XString.Factory<T extends XString>

A factory interface for creating new concrete instances of an XString


Field Summary
static String PROP_INITIAL_LENGTH
          Property name used to control the initial length (in UTF-8 encoded bytes) of strings created by a factory.
static String PROP_NATIVE
          Property name used to control whether or not strings created by a factory are backed by native buffers.
static String PROP_POOL_PREALLOCATE_COUNT
          Property indicating whether or not the pool backing the factory should preallocate XStrings to avoid object promotion at runtime.
static String PROP_POOL_THREADED
          Property indicating whether or not the pool backing the factory is a thread safe.
static String PROP_POOLED
          Property indicating whether or not the factory is backed by a pool.
 
Method Summary
 T create()
          Returns an empty, mutable XString possibly from a backing pool.
 T create(boolean mutable)
          Returns an empty XString possibly from a backing pool.
 T create(String value)
          Creates an immutable XString, possibly from a backing pool, from the given String value.
 T create(String initialValue, boolean mutable)
          Creates an XString possibly from a backing pool.
 T create(XString initialValue, boolean mutable)
          Creates an XString possibly from a backing pool.
 T[] createArray(int size)
           
 

Field Detail

PROP_INITIAL_LENGTH

static final String PROP_INITIAL_LENGTH
Property name used to control the initial length (in UTF-8 encoded bytes) of strings created by a factory.

Specifying a value of 0 will cause no backing buffer for the XString to be preallocated which can be useful for preventing object promotions at runtime.

If the XString is later initialized to a value large than the specified initial length a new backing buffer will be allocated to accommodate the larger size.

See Also:
Constant Field Values

PROP_NATIVE

static final String PROP_NATIVE
Property name used to control whether or not strings created by a factory are backed by native buffers.

See Also:
Constant Field Values

PROP_POOLED

static final String PROP_POOLED
Property indicating whether or not the factory is backed by a pool.

This Property applies to XString.Factorys for XString subclasses that support pooling.

See Also:
Constant Field Values

PROP_POOL_THREADED

static final String PROP_POOL_THREADED
Property indicating whether or not the pool backing the factory is a thread safe.

This Property applies to XString.Factorys for XString subclasses that support pooling or preallocation.

See Also:
Constant Field Values

PROP_POOL_PREALLOCATE_COUNT

static final String PROP_POOL_PREALLOCATE_COUNT
Property indicating whether or not the pool backing the factory should preallocate XStrings to avoid object promotion at runtime.

This Property only applies to XString.Factorys for XString subclasses that support preallocation

See Also:
Constant Field Values
Method Detail

create

T create()
Returns an empty, mutable XString possibly from a backing pool. When the the user is done with the XString, dispose() should be called if the the XString is a poolable type, to return the object to the pool.

Returns:
An uninitialized XString.

createArray

T[] createArray(int size)
Parameters:
size - the size of the array to create
Returns:
A mutable array of uninitialized strings.

create

T create(boolean mutable)
Returns an empty XString possibly from a backing pool. When the the user is done with the XString, dispose() should be called if the the XString is a poolable type, to return the object to the pool.

Parameters:
mutable - Whether or not the XString supports mutation (after it is first set)
Returns:
An uninitialized XString.

create

T create(String value)
Creates an immutable XString, possibly from a backing pool, from the given String value. When the the user is done with the XString, dispose() should be called if the the XString is a poolable type, to return the object to the pool.

Parameters:
value - The string value to assign to the XString.
Returns:
An initialized XString

create

T create(String initialValue,
         boolean mutable)
Creates an XString possibly from a backing pool. When the the user is done with the XString, dispose() should be called if the the XString is a poolable type, to return the object to the pool.

Parameters:
initialValue - The string value to assign to the XString.
mutable - Whether or not the XString supports mutation.
Returns:
An initialized XString

create

T create(XString initialValue,
         boolean mutable)
Creates an XString possibly from a backing pool. When the the user is done with the XString, dispose() should be called if the the XString is a poolable type, to return the object to the pool.

Parameters:
initialValue - The string value to assign to the XString.
mutable - Whether or not the XString supports mutation.
Returns:
An initialized XString.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.