code: public static XdmValue newValue(ValueType valueType, Object value) {
          if (value instanceof Text) {
              return ValueFactory.newValue(valueType, ((Text)value).toString());
          } else if (value instanceof BytesWritable) {
              return ValueFactory.newValue(valueType, ((BytesWritable)value).getBytes());
          } else if (value instanceof IntWritable) {
              return ValueFactory.newValue(valueType, ((IntWritable)value).get());
          } else if (value instanceof LongWritable) {
              return ValueFactory.newValue(valueType, ((LongWritable)value).get());
          } else if (value instanceof VIntWritable) {
              return ValueFactory.newValue(valueType, ((VIntWritable)value).get());
          } else if (value instanceof VLongWritable) {
              return ValueFactory.newValue(valueType, ((VLongWritable)value).get());
          } else if (value instanceof BooleanWritable) {
              return ValueFactory.newValue(valueType, ((BooleanWritable)value).get());
          } else if (value instanceof FloatWritable) {
              return ValueFactory.newValue(valueType, ((FloatWritable)value).get());
          } else if (value instanceof DoubleWritable) {
              return ValueFactory.newValue(valueType, ((DoubleWritable)value).get());
          } else if (value instanceof MarkLogicNode) {
              return ValueFactory.newValue(valueType, ((MarkLogicNode)value).get());
          } else {
              throw new UnsupportedOperationException("Value " +  
                      value.getClass().getName() + " is unsupported.");
          }
      }
docs: Create new XdmValue from value type and Writables.