Class ObjectGenerator
- java.lang.Object
-
- com.opencloud.slee.upgrade.transformation.model.ObjectGenerator
-
- Direct Known Subclasses:
ObjectGenerator.ArrayGenerator
,ObjectGenerator.FunctionGenerator
,ObjectGenerator.StringGenerator
public abstract class ObjectGenerator extends java.lang.Object
An object generator produces an object, which may be a string, a null, or an array of such items.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ObjectGenerator.ArrayGenerator
A type ofObjectGenerator
which always returns an array.static class
ObjectGenerator.ConstantGenerator
A type ofObjectGenerator.StringGenerator
which always returns a fixed, non-null string value.static class
ObjectGenerator.FunctionGenerator
A type ofObjectGenerator
which returns values based on someValueFunction
.static class
ObjectGenerator.NullValueGenerator
A type ofObjectGenerator.StringGenerator
which always returns the null value.static class
ObjectGenerator.StringGenerator
A type ofObjectGenerator
which always generates aString
value.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
equals(java.lang.Object o)
java.lang.Object
generate()
Generates an Object value (which may be null).
This method must only be called if this object'sneedsContext()
method returns false, otherwise thegenerate(GeneratorContext)
method must be called instead.java.lang.Object
generate(GeneratorContext context)
Generates an Object value (which may be null), based on the given context.abstract int
hashCode()
static boolean
isArray(java.lang.Object value)
Returns true if the given value is a non-null array object, false otherwise.boolean
needsContext()
Returns true if this class requires that calls to generate a value be passed aGeneratorContext
object, false otherwise.
If it returns true, then only thegenerate(GeneratorContext)
method may be called to generate values; thegenerate()
method should never be called.
If it returns false, then either method may be called.abstract java.lang.String
toString()
-
-
-
Method Detail
-
needsContext
public boolean needsContext()
Returns true if this class requires that calls to generate a value be passed aGeneratorContext
object, false otherwise.
If it returns true, then only thegenerate(GeneratorContext)
method may be called to generate values; thegenerate()
method should never be called.
If it returns false, then either method may be called.
-
isArray
public static boolean isArray(java.lang.Object value)
Returns true if the given value is a non-null array object, false otherwise.
-
generate
@Nullable public java.lang.Object generate(GeneratorContext context) throws TransformationException
Generates an Object value (which may be null), based on the given context.- Parameters:
context
- Contains information about the context in which the value is being generated.- Throws:
TransformationException
-
generate
@Nullable public java.lang.Object generate()
Generates an Object value (which may be null).
This method must only be called if this object'sneedsContext()
method returns false, otherwise thegenerate(GeneratorContext)
method must be called instead.
-
toString
public abstract java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public abstract boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public abstract int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-