com.ibm.streams.operator
Interface Type
-
- All Known Subinterfaces:
- BoundedType, CollectionType, CompositeType, EnumType, MapType, TupleType, XMLType
public interface Type
Describes a specific type within a StreamSchema and its representation within Java.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static class
Type.Factory
Factory for creating SPL type related objects.static class
Type.MetaType
Enumeration of SPL types.
-
Method Summary
Methods Modifier and Type Method and Description java.lang.Class<?>
getAsCompositeElementType()
Get the type of the object returned for this type when stored in a collection type.java.lang.Object
getDefaultValue()
Get an object that represents the default initial value for this type.java.lang.String
getLanguageType()
Returns the type name as it appears in SPL.Type.MetaType
getMetaType()
Return the enumeration representing the meta-type.java.lang.Class<?>
getObjectType()
Get the type of the object returned for this type from a generic object based getter.java.lang.Object
randomValue(java.util.Random rand)
Return a randomly generated value for testing.java.lang.String
toString(java.lang.Object value)
Returns a string that textually represents a value of this type, typically usingObject.toString()
ofgetObjectType()
.
-
-
-
Method Detail
-
getMetaType
Type.MetaType getMetaType()
Return the enumeration representing the meta-type.- Returns:
- Enumeration for the meta-type.
-
getLanguageType
java.lang.String getLanguageType()
Returns the type name as it appears in SPL.- Returns:
- SPL name of the type
-
getObjectType
java.lang.Class<?> getObjectType()
Get the type of the object returned for this type from a generic object based getter.- Returns:
- Java Class reference describing the type.
- See Also:
Tuple.getObject(int)
-
getAsCompositeElementType
java.lang.Class<?> getAsCompositeElementType()
Get the type of the object returned for this type when stored in a collection type.- Returns:
- Class of type when stored in a collection.
-
getDefaultValue
java.lang.Object getDefaultValue()
Get an object that represents the default initial value for this type. For numeric values this corresponds to zero, for string values the empty string and for collections an empty collection.- Returns:
- Default value for this type.
-
randomValue
java.lang.Object randomValue(java.util.Random rand)
Return a randomly generated value for testing.- Parameters:
rand
- Random object used to generate value.- Returns:
- A random value valid for this type
-
toString
java.lang.String toString(java.lang.Object value)
Returns a string that textually represents a value of this type, typically usingObject.toString()
ofgetObjectType()
. The returned value is not always the same as SPL character encoding for the type, specifically:- Parameters:
value
- Value to be represented as aString
.- Returns:
String
that textually representsvalue
.- Throws:
java.lang.ClassCastException
-value
is not an instance ofgetObjectType()
.- See Also:
Tuple.getString(int)
-
-