public final class VariantUtilities extends Object
| Modifier and Type | Method and Description |
|---|---|
protected static Variant[] |
objectsToVariants(Object[] arrayOfObjectsToBeConverted)
converts an array of objects into an array of Variants by repeatedly
calling obj2Variant(Object)
|
protected static Variant |
objectToVariant(Object objectToBeMadeIntoVariant)
Map arguments based on msdn documentation.
|
protected static void |
populateVariant(Variant targetVariant,
Object pValueObject,
boolean fByRef)
Populates a variant object from a java object.
|
static BigDecimal |
roundToMSDecimal(BigDecimal sourceDecimal)
Rounds the scale and bit length so that it will pass
validateDecimalScaleBits().
|
protected static void |
validateDecimalMinMax(BigDecimal in)
Does any validation that couldn't have been fixed by rounding or scale
modification.
|
protected static void |
validateDecimalScaleAndBits(BigDecimal in)
Verifies that we have a scale 0 <= x <= 28 and now more than 96 bits of
data.
|
protected static Object |
variantToObject(Variant sourceData)
Convert a JACOB Variant value to a Java object (type conversions).
|
protected static void populateVariant(Variant targetVariant, Object pValueObject, boolean fByRef)
targetVariant - pValueObject - fByRef - protected static Variant objectToVariant(Object objectToBeMadeIntoVariant)
objectToBeMadeIntoVariant - protected static Variant[] objectsToVariants(Object[] arrayOfObjectsToBeConverted)
arrayOfObjectsToBeConverted - protected static Object variantToObject(Variant sourceData)
Unlike other toXXX() methods, it does not do a type conversion except for special data types (it shouldn't do any!)
Converts Variant.VariantArray types to SafeArrays
IllegalStateException - if no underlying windows data structureNotImplementedException - if unsupported conversion is requestedJacobException - if the calculated result was a JacobObject usually as a
result of errorprotected static void validateDecimalScaleAndBits(BigDecimal in)
in - IllegalArgumentException - if out of boundsprotected static void validateDecimalMinMax(BigDecimal in)
in - The BigDecimal to be validatedIllegalArgumentException - if the number is too large or too small or nullpublic static BigDecimal roundToMSDecimal(BigDecimal sourceDecimal)
Changing the scale on a number that can fit in an MS Decimal can change the number's representation enough that it will round to a number too large to be represented by an MS VT_DECIMAL
sourceDecimal - http://jacob-project.sourceforge.net