com.neeve.lang
Class XString.XStringFactory

java.lang.Object
  extended by com.neeve.lang.XString.XStringFactory
All Implemented Interfaces:
XString.Factory<XString>
Enclosing class:
XString

public static final class XString.XStringFactory
extends Object
implements XString.Factory<XString>

A. factory for XStrings which does not support pooling or preallocation.


Field Summary
 
Fields inherited from interface com.neeve.lang.XString.Factory
PROP_INITIAL_LENGTH, PROP_NATIVE, PROP_POOL_PREALLOCATE_COUNT, PROP_POOL_THREADED, PROP_POOLED
 
Method Summary
 XString create()
          Returns an empty, mutable XString possibly from a backing pool.
 XString create(boolean mutable)
          Returns an empty XString possibly from a backing pool.
 XString create(String value)
          Creates an immutable XString possibly from a backing pool.
 XString create(String initialValue, boolean mutable)
          Creates a XString possibly from a backing pool.
 XString create(XString initialValue, boolean mutable)
          Creates a XString possibly from a backing pool.
 XString[] createArray(int size)
          Returns an array of mutable XString possibly from a backing pool.
 boolean getIsNative()
           
 int getStringLength()
           
static XString.Factory<? extends XString> newFactory(String name, int stringLength, boolean isNative)
          Constructs a new Factory for XStrings.
static XString.Factory<? extends XString> newFactory(String name, int stringLength, boolean pooled, int preallocationCount, boolean threaded, boolean isNative)
          Deprecated. XStrings don't support pooling or preallocation. Use XPooledString instead
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newFactory

public static XString.Factory<? extends XString> newFactory(String name,
                                                            int stringLength,
                                                            boolean isNative)
Constructs a new Factory for XStrings.

Parameters:
name - A name unique to this factory type which is used to uniquely identify the underlying pool.
stringLength - The expected length of the string which is used to size its backing buffer. Specifying a value of 0 indicates that a backing buffer should not be preallocated.
isNative - Whether or not the XStrings should use native backing buffers (when enabled/supported)
Returns:
A new Factory.

newFactory

@Deprecated
public static XString.Factory<? extends XString> newFactory(String name,
                                                                       int stringLength,
                                                                       boolean pooled,
                                                                       int preallocationCount,
                                                                       boolean threaded,
                                                                       boolean isNative)
Deprecated. XStrings don't support pooling or preallocation. Use XPooledString instead

Constructs a new Factory for XStrings.

Parameters:
name - A name unique to this factory type which is used to uniquely identify the underlying pool.
stringLength - The expected length of the string which is used to size its backing buffer. Specifying a value of 0 indicates that a backing buffer should not be preallocated.
isNative - Whether or not the XStrings should use native backing buffers (when enabled/supported)
pooled - Whether or not to back the factory with a pool.
preallocationCount - The number of XString to preallocate.
threaded - Whether or not the backing pool should be thread safe.
Returns:
A new Factory.

getIsNative

public final boolean getIsNative()
Returns:
Whether or not this factory returns types backed by native buffers

getStringLength

public final int getStringLength()
Returns:
The string length configured for this factory (which is used to determine the initial size of the backing buffer.

create

public final XString create()
Returns an empty, mutable XString possibly from a backing pool. When the the user is done with the XString, dispose() should be called, to return it to the pool.

Specified by:
create in interface XString.Factory<XString>
Returns:
An uninitialized XString.

createArray

public final XString[] createArray(int size)
Returns an array of mutable XString possibly from a backing pool. When the the user is done with the array, dispose() should be called on each of the elements to return return them to the pool.

Specified by:
createArray in interface XString.Factory<XString>
Parameters:
size - the size of the array to create
Returns:
An uninitialized XString.

create

public final XString create(String value)
Creates an immutable XString possibly from a backing pool. When the the user is done with the XString, dispose() should be called, to return it to the pool.

Specified by:
create in interface XString.Factory<XString>
Parameters:
value - The string value to assign to the XString.
Returns:
An initialized XString

create

public final XString 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, to return it to the pool.

Specified by:
create in interface XString.Factory<XString>
Parameters:
mutable - Whether or not the XString supports mutation (after it is first set)
Returns:
An uninitialized XString.

create

public final XString create(String initialValue,
                            boolean mutable)
Creates a XString possibly from a backing pool. When the the user is done with the XString, dispose() should be called, to return it to the pool.

Specified by:
create in interface XString.Factory<XString>
Parameters:
initialValue - The string value to assign to the XString.
mutable - Whether or not the XString supports mutation.
Returns:
An initialized XString

create

public final XString create(XString initialValue,
                            boolean mutable)
Creates a XString possibly from a backing pool. When the the user is done with the XString, dispose() should be called, to return it to the pool.

Specified by:
create in interface XString.Factory<XString>
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.