com.neeve.lang
Interface XIntAdapter<T>


public interface XIntAdapter<T>

Adapts an int to another type.


Method Summary
 T adaptFrom(int from)
          Returns the adapated value or null if the value can't be adapted.
 int adaptTo(T to)
           
 boolean canAdaptFrom(int from)
          Test if the adapter is able to adapt from an int to the given type.
 T[] newArray(int size)
          Creates a new array of type T.
 

Method Detail

canAdaptFrom

boolean canAdaptFrom(int from)
Test if the adapter is able to adapt from an int to the given type.

Parameters:
from - The int value from which to adapt.
Returns:
True if the int value can be adapted, false if it doesn't correspond to a value.
Throws:
IllegalArgumentException - If the value cannot be adapted.

adaptFrom

T adaptFrom(int from)
Returns the adapated value or null if the value can't be adapted.

A return value of null could either mean that the value adapted to null or that the adapter can't adapt the value. If the value is null the caller can distinguish between the two cases by calling canAdaptFrom(int).

Parameters:
from - The int value from which to adapt.
Returns:
The adapted value.
Throws:
IllegalArgumentException - If the value cannot be adapted.

adaptTo

int adaptTo(T to)
Parameters:
to - The value to adapt to an int.
Returns:
The adapted value
Throws:
IllegalArgumentException - If the value cannot be adapted.

newArray

T[] newArray(int size)
Creates a new array of type T.

Parameters:
size - the size of the array.
Returns:
A new array of type T.


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